SQL CASE CASE in a clause ORDER BY

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

We can use 1,2,3.. to determine the type of order:

SELECT * FROM DEPT
ORDER BY
CASE DEPARTMENT
      WHEN 'MARKETING' THEN  1
      WHEN 'SALES' THEN 2
      WHEN 'RESEARCH' THEN 3
      WHEN 'INNOVATION' THEN 4
      ELSE        5
      END,
      CITY
IDREGIONCITYDEPARTMENTEMPLOYEES_NUMBER
12New EnglandBostonMARKETING9
15WestSan FranciscoMARKETING12
9MidwestChicagoSALES8
14Mid-AtlanticNew YorkSALES12
5WestLos AngelesRESEARCH11
10Mid-AtlanticPhiladelphiaRESEARCH13
4MidwestChicagoINNOVATION11
2MidwestDetroitHUMAN RESOURCES9


Got any SQL Question?