DATABASE SYSTEM CONCEPTS (LOOSELEAF)
DATABASE SYSTEM CONCEPTS (LOOSELEAF)
7th Edition
ISBN: 9781260515046
Author: SILBERSCHATZ
Publisher: MCG
bartleby

Concept explainers

bartleby

Videos

Question
Book Icon
Chapter 3, Problem 1PE

a.

Program Plan Intro

Refer the university schema from the textbook for the following subparts.

a.

Expert Solution
Check Mark

Explanation of Solution

Query:

Select title from where dept_name= ‘Comp.Sci’ and credits=3

Explanation:

  • In the above query, “Select”, “from”, and “where” are the keywords in Structured Query Language (SQL).
  • This query selects the title of courses where department matches with “Comp.Sci” department and credits is equal to “3”.

b.

Explanation of Solution

Query:

Select distinct student.ID from (student join takes using (ID)) join (instructor join teaches using(ID)) using(course_id,sec_id,semester,year) where instructor.name= ‘Einstein’

Explanation:

  • In the above query, “Select”, “distinct”, “from”, “join”, “using” and “where” are the keywords in Structured Query Language (SQL).
  • In this query, the join operation is performed between student and instructor table using the ID’s.
  • Then it retrieves the fields such as course id, section id, semester and year of the student. In that fields, select the distinct student ID taught by the instructor name “Einstein”.

c.

Explanation of Solution

Query:

Select max(salary) from instructor

Explanation:

  • In the above query, “Select”, “from”, and “max” are the keywords in Structured Query Language (SQL).
  • This query selects the maximum salary of the instructor from instructor table.

d.

Explanation of Solution

Query:

Select ID,name from instructor where salary=(select max(salary) from instructor)

Explanation:

  • In the above query, “Select”, “from”, and “where” are the keywords in Structured Query Language (SQL).
  • This query selects the ID and name from the instructor table where salary is equal to maximum salary from the instructor table.

e.

Explanation of Solution

Query:

Select course_id,sec_id,count(ID) from section natural join takes where semester= ‘Fall’ and year=2017 group by course_id, sec_id

Explanation:

  • In the above query, “Select”, “from”, “natural join”, “group by” and “where” are the keywords in Structured Query Language (SQL).
  • This query selects the course id, section id and count of enrollment of each section where semester is “Fall” season and year is “2017”.

f.

Explanation of Solution

Query:

Select max(enrollment) from (select count(ID) as enrollment from section natural join takes where semester= ‘Fall’ and year=2017 group by course_id, sec_id)

Explanation:

  • In the above query, “Select”, “from”, “natural join”, “group by” and “where” are the keywords in Structured Query Language (SQL).
  • This query selects the number of IDs from enrolment sections where semester is “Fall” season and year is “2017”.
  • After selecting number of IDs, select the maximum enrollment from all section.

g.

Explanation of Solution

Query:

With sec_enrollment as (select course_id,sec_id,count(ID) from section natural join takes where semester= ‘Fall’ and year=2017 group by course_id, sec_id)

Select course_id,sec_id from sec_enrollment where enrollment=(select max(enrollment) from sec_enrollment)

Explanation:

  • In the above query, “Select”, “from”, “natural join”, “group by” and “where” are the keywords in Structured Query Language (SQL).
  • This first inner query selects the number of IDs from enrolment sections where semester is “Fall” season and year is “2017”.
    • After selecting number of IDs, select the maximum enrollment from all section.
    • It is stored in temporary view as “sec_enrollment”.
  • Next the second inner query selects the maximum enrollment from “sec_enrollment” which displays the section id, course id from the table.

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
Which of the following methods help when a model suffers from high variance? a. Increase training data. b. Increase model size. c. Decrease the amount of regularization. d. Perform feature selection.
57 Formula 1 point Use shift folding, length 3, on the following value to calculate the Hash Value. 114184121 Type your answer...
Write a program that reads a list of 10 integers, and outputs those integers in reverse. For coding simplicity, follow each output integer by a space, including the last one. Then, output a newline. Ex: If the input is: 2 4 6 8 10 12 14 16 18 20 the output is: 20 18 16 14 12 10 8 642 To achieve the above result, first read the integers into an array. Then output the array in reverse. 623802 1031906 nx3zmv7.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
SQL Basics for Beginners | Learn SQL | SQL Tutorial for Beginners | Edureka; Author: edureka;https://www.youtube.com/watch?v=zbMHLJ0dY4w;License: Standard YouTube License, CC-BY