Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions select-from-nobel.sql
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,12 @@ The expression subject IN ('Chemistry','Physics') can be used as a value - it wi

Show the 1984 winners ordered by subject and winner name; but list Chemistry and Physics last.
*/
SELECT winner, subject, subject IN ('Physics','Chemistry')
SELECT winner, subject
FROM nobel
WHERE yr=1984
ORDER BY subject IN ('Physics','Chemistry'),subject,winner
WHERE yr = 1984
ORDER BY
CASE
WHEN subject IN ('Chemistry', 'Physics') THEN 1
ELSE 0
END ASC,
subject ASC,