sqlzoo-select from nobel

3. select from nobel

  1. 更改显示的查询,以显示1950年的诺贝尔奖。
 select yr, subject, winner 
 from nobel
  where yr = 1950;
  1. 顯示誰贏得了1962年文學獎(Literature)。
select winner 
from nobel 
where yr = 1962 and subject = 'Literature';
  1. 顯示“愛因斯坦”(‘Albert Einstein’) 的獲獎年份和獎項。
select yr, subject 
from nobel 
where winner = 'Albert Einstein';
  1. 顯示2000年及以後的和平獎(‘Peace’)得獎者。
select winner 
from nobel 
where yr >= 2000 and subject = 'Peace';
  1. 顯示1980年至1989年(包含首尾)的文學獎(Literature)獲獎者所有細節(年,主題,獲獎者)。
select yr, subject, winner 
from nobel 
where(yr between 1980 and 1989) and subject = 'Literature';
  1. 顯示總統獲勝者的所有細節:

    • 西奧多•羅斯福 Theodore Roosevelt
    • 伍德羅•威爾遜 Woodrow Wilson
    • 吉米•卡特 Jimmy Carter
select * 
from nobel 
where winner in ('Theodore Roosevelt', 'Woodrow Wilson', 'Jimmy Carter');
  1. 顯示名字為John 的得獎者。 (注意:外國人名字(First name)在前,姓氏(Last name)在後)
select winner 
from nobel 
where winner like 'John%';
  1. 顯示1980年物理學(physics)獲獎者,及1984年化學獎(chemistry)獲得者。
select * 
from nobel 
where (yr = 1980 and subject = 'Physics') or (yr = 1984 and subject = 'Chemistry'); 
  1. 查看1980年獲獎者,但不包括化學獎(Chemistry)和醫學獎(Medicine)。
select * 
from nobel 
where yr = 1980 and subject not in ('Chemistry', 'Medicine');
  1. 顯示早期的醫學獎(Medicine)得獎者(1910之前,不包括1910),及近年文學獎(Literature)得獎者(2004年以後,包括2004年)。
select * 
from nobel 
where (yr < 1910 and subject = 'Medicine') or (yr >= 2004 and subject = 'Literature');
  1. Find all details of the prize won by PETER GRÜNBERG
select * 
from nobel 
where winner like 'Peter Grünberg';
  1. 查找尤金•奧尼爾Eugene O’Neill得獎的所有細節
select * 
from nobel 
where winner= "Eugene O'Neill";
  1. 列出爵士的獲獎者、年份、獎頁(爵士的名字以Sir開始)。先顯示最新獲獎者,然後同年再按名稱順序排列。
select winner, yr, subject
from nobel 
where winner like 'Sir%' 
order by yr desc, winner;
  1. 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 subject IN ('Physics','Chemistry'),subject,winner
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值