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
ID | REGION | CITY | DEPARTMENT | EMPLOYEES_NUMBER |
---|---|---|---|---|
12 | New England | Boston | MARKETING | 9 |
15 | West | San Francisco | MARKETING | 12 |
9 | Midwest | Chicago | SALES | 8 |
14 | Mid-Atlantic | New York | SALES | 12 |
5 | West | Los Angeles | RESEARCH | 11 |
10 | Mid-Atlantic | Philadelphia | RESEARCH | 13 |
4 | Midwest | Chicago | INNOVATION | 11 |
2 | Midwest | Detroit | HUMAN RESOURCES | 9 |