Concept explainers
a.
Refer the university schema from the textbook for the following subparts.
a.
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?
Chapter 3 Solutions
DATABASE SYSTEM CONCEPTS (LOOSELEAF)
- After our initial deployment for our ML home based security system, the first steps we took to contribute further to the project, we conducted load testing, tested and optimize for low latency, and automated user onboarding. What should be next?arrow_forwardWhy investing in skills and technology is a critical factor in the financial management aspect of system projects.arrow_forwardwhy investing in skills and technology is a critical factor in the financial management aspect of systems projects.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education