Exercise: Count Unique Values
Count the number of different grades.
Solution
sql
1SELECT COUNT(DISTINCT grade) FROM students;Practice
sql
1-- Count unique ages
2SELECT COUNT(DISTINCT age) FROM students;
3
4-- Count unique ages of Python students
5SELECT COUNT(DISTINCT age) FROM students
6WHERE course = 'Python';