Skip to content

Commit e39729d

Browse files
authored
[SQL-35] How to Sort SQL Results with NULL Values at the End When Ascending (#374)
1 parent 46aef35 commit e39729d

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SELECT * FROM Student
2+
ORDER BY
3+
CASE WHEN graduation_date IS NULL THEN 1 ELSE 0 END,
4+
graduation_date ASC;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SELECT * FROM Student ORDER BY graduation_date ASC NULLS LAST;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SELECT * FROM Student
2+
ORDER BY
3+
CASE WHEN graduation_date IS NULL THEN 1 ELSE 0 END,
4+
graduation_date ASC;

0 commit comments

Comments
 (0)