查找尤金•奧尼爾EUGENE O’NEILL得獎的所有細節
select * from nobel
where winner='EUGENE O''NEILL'
#字符有单引号,多打一个引号转义
列出爵士的獲獎者、年份、獎頁(爵士的名字以Sir開始)。先顯示最新獲獎者,然後同年再按名稱順序排列。
select winner,yr,subject from nobel
where winner like 'Sir%'
order by yr desc,winner#双层排序注意逗号
14.The expression subject IN (‘Chemistry’,‘Physics’) can be used as a value - it will be 0 or 1.
Show the 1984 winners and subject ordered by subject and winner name; but list Chemistry and Physics last.
SELECT winner, subject
from nobel
WHERE yr='1984'
ORDER BY
case when subject IN ('physics','chemistry') then 1
else 0 end,
subject,winner