COUNT variants with NULLs and duplicates

A university stores course enrolments in the table enrolments below, where a NULL grade means the grade has not yet been recorded.


enrol_id

student_id

course

grade

1

101

DB

78

2

102

DB

NULL

3

101

OS

85

4

103

DB

78

5

102

OS

NULL

6

104

DB

91


The query SELECT COUNT(*), COUNT(grade), COUNT(DISTINCT student_id), COUNT(DISTINCT grade) FROM enrolments; is run. Enter each result as a whole number. COUNT(*) returns , COUNT(grade) returns , COUNT(DISTINCT student_id) returns , and COUNT(DISTINCT grade) returns .

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Advanced Queries Questions: