Question: Assume you have been asked to write and execute a query to retrieve the list of ALL departments and the number of sections offered in

Assume you have been asked to write and execute a query to retrieve the list of ALL departments and the number of sections offered in a university semester for each department. If a department has not offered any section this semester, the department should appear in the list with the number 0.
For each of the following SQL statements, state "Yes" if it retrieves the information requested and "No" if otherwise.
1. SELECT DCode,DName, COUNT(s.SectId) as Sections FROM Department d JOIN Course c on d.DCode = c.Department
JOIN Section s on c.CoCode = s.Course WHERE s.Semester ='1248' OR s.Semester is NULL
GROUP BY DCode;
2. SELECT DCode,DName, COUNT(s.SectId) as Sections FROM Department d LEFT JOIN Course c on d.DCode = c.Department
LEFT JOIN Section s on c.CoCode = s.Course WHERE s.Semester ='1248' OR s.Semester is NULL
GROUP BY DCode;
3. SELECT DCode,DName, COUNT(s.SectId) as Sections FROM Department d LEFT JOIN Course c on d.DCode = c.Department
LEFT JOIN Section s on c.CoCode = s.Course WHERE s.Semester ='1248'
GROUP BY DCode;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!