Sql question

Mar 17, 2021 107 Comments

Schema::

Student_id, depart_id, coach_id, date

Find AVERAGE number of students per department in March 2021

Is window function needed here?? I know a group by depart_id is used and i can count number of students by using count (*) but how do I calculate average?


Edit: one student could belong to multiple departments

Thanks in advance.
#sql #sqlinterview

comments

Want to comment? LOG IN or SIGN UP
TOP 107 Comments