Sorting Unique Values
Combine DISTINCT with ORDER BY.
sql
1SELECT DISTINCT course FROM students
2ORDER BY course;Returns unique courses in alphabetical order.
Descending
sql
1SELECT DISTINCT marks FROM students
2ORDER BY marks DESC;
Combine DISTINCT with ORDER BY.
1SELECT DISTINCT course FROM students
2ORDER BY course;Returns unique courses in alphabetical order.
1SELECT DISTINCT marks FROM students
2ORDER BY marks DESC;