SQL Exercise Answers 10-11
Exercise 10.11
Display the count of the number of students in each courseid using a GROUP BY clause.
To do this, create a SQL statement using an INNER JOIN using the person and studentgrade tables.
Then modify the query by adding in the GROUP BY courseid.
To work out the number of persons, use the COUNT keyword.
SELECT count(person.lastname), studentgrade.courseid FROM person INNER JOIN studentgrade ON person.personid = studentgrade.studentid GROUP BY studentgrade.courseid