159k views
0 votes
Write a SQL statement to display course name, course number, and the average capacity of all sectionsof each course, rounded to four decimal places, where students are enrolled, and the average capacityis less than twenty five (use a correlated sub-query and use a column alias of AVERAGECAPACITY torepresent the number.

User Elti Musa
by
2.7k points

1 Answer

4 votes

Answer:

SELECT C. DESCRIPTION, C. COURSE_NO, ROUND(AVG(CAPACITY), 4) AS AVERAGECAPACITY

FROM COURSE C, SECTION S

WHERE C. COURSE_NO = S. COURSE_NO

GROUP BY C. COURSE_NO

HAVING AVG(CAPACITY)<25

User Angello
by
2.8k points