Question: Q . 2 ) Aggregate Functions ( 5 0 points ) Write a query to find, for each combination of year and building name, the

Q.2) Aggregate Functions (50 points)
Write a query to find, for each combination of year and building name, the number of
instructors who have taught a course and the average course duration in seconds. The
query should only include groups where there are at least 2 unique instructors, and the
average course duration is less than 5,000 seconds (equivalent to approximately 1 hour and
23 minutes).
Hint: You may need to use the TIME_TO_SEC & TIMEDIFF function to properly calculate
the Avg_Course_Duration column values.
Your result should display the following columns:
1. Year The year when the course sections were offered.
2. Building_Name The name of the building where the course sections were held.
3. Number_Of_Instructors The total number of distinct instructors who taught in that
building for the corresponding year.
4. Avg_Course_Duration The average duration of all the course sections (in seconds)
taught in that building and year combination.
Include an ORDER BY clause to ensure the results highlight more recent years, with
preference given to buildings that had more instructors teaching courses, and within those
groups, prioritize sections with longer average durations.
Your result set should have 9 rows returned.

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!