▸_sqlgym

6. Custom Priority Sort

MediumOrderingCASE in ORDER BYcustom collation order

Sometimes the sort order isn't alphabetical or numeric. A CASE expression inside ORDER BY maps values to a custom rank.

Task: return title and priority from tasks, ordered so that high priority comes first, then medium, then low. Within the same priority, order by created ascending.

Tables
Loading schema…
Expected outputrows must come back in this order
Computing expected output…

This is the result for the example data above. On Submit your query is graded against this example plus 4 hidden edge cases 5test cases in all. A sloppy query that only fits the example won't pass.

SQL
⌘/Ctrl+↵ run · ⇧⌘/Ctrl+↵ submit
Run a query to see its output here.