sqlzoo刷题 SELECT from Nobel Tutorial
SELECT from Nobel Tutorial
1.Change the query shown so that it displays Nobel prizes for 1950.
SELECT yr, subject, winner
FROM nobel
WHERE yr = 1950

2.Show who won the 1962 prize for Literature.
SELECT winner
FROM nobel
WHERE yr = 1962
AND subject = 'Literature'

3.Show the year and subject that won 'Albert Einstein' his prize.
select yr,subject
from nobel
where winner='Albert Einstein'

4.Give the name of the 'Peace' winners since the year 2000, including 2000.
select winner
from nobel
where subject='Peace' and yr>=2000

5.Show all details (yr, subject, winner) of the Literature prize winners for 1980 to 1989 inclusive.
select yr,subject,winner
from nobel
where subject='Literature' and yr between 1980 and 1989

6.Show all details of the presidential winners:
- Theodore Roosevelt
- Woodrow Wilson
- Jimmy Carter
- Barack Obama
SELECT * FROM nobel
WHERE winner IN ('Theodore Roosevelt',
'Woodrow Wilson',
'Jimmy Carter',
'Barack Obama')

7.Show the winners with first name John
select winner
from nobel
where winner like 'John %'

8.Show the year, subject, and name of Physics winners for 1980 together with the Chemistry winners for 1984.
select yr,subject,winner
from nobel
where subject='Physics' and yr=1980 or subject='Chemistry' and yr=1984

9.Show the year, subject, and name of winners for 1980 excluding Chemistry and Medicine
select yr,subject,winner
from nobel
where yr =1980 and subject not in('Chemistry','Medicine')

10.Show year, subject, and name of people who won a 'Medicine' prize in an early year (before 1910, not including 1910) together with winners of a 'Literature' prize in a later year (after 2004, including 2004)
select yr,subject,winner
from nobel as n1
where n1.subject='Medicine' and yr<1910 or subject='Literature' and yr>=2004

11.Find all details of the prize won by PETER GRÜNBERG
select *
from nobel
where winner='PETER GRÜNBERG'

12.Find all details of the prize won by EUGENE O'NEILL
select * from nobel where winner='EUGENE O\'NEILL'

note : 这里应该是要使用转义字符的,mysql的转义字符是/,不知道为什么会报错,网上看了别人的答案也是这样的,但是他们的通过了,我的报错
13.Knights in order
List the winners, year and subject where the winner starts with Sir. Show the the most recent first, then by name order.
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 subject IN ('Physics','Chemistry'),subject,winner

note : 这里不懂为啥报错,网上找的答案都是这样写的,但是他们的通过了,我的报错了
sqlzoo刷题 SELECT from Nobel Tutorial的更多相关文章
- SQLZOO练习二--SELECT from Nobel Tutorial
We continue practicing simple SQL queries on a single table. This tutorial is concerned with a table ...
- SELECT from Nobel Tutorial
02.SELECT from Nobel Tutorial 注意:where语句中对表示条件的需要用单引号, 下面的译文使用的是有道翻译如有不正确,请直接投诉有道 01.Change the quer ...
- MySQL练习题--sqlzoo刷题2
SELECT from Nobel Tutorial 1.Change the query shown so that it displays Nobel prizes for 1950. SELEC ...
- MySQL练习题--sqlzoo刷题
首先查看world表的字段: name continent area population gdp capital tld flag SELECT * FROM world: 2.显示人口至少为2亿的 ...
- sqlzoo - SELECT from WORLD Tutorial 答案
01.SELECT from WORLD Tutorial 01.显示所有国家的名称,大洲和人口. SELECT name, continent, population FROM world; 02. ...
- sqlzoo.net刷题
只发后面提升题目的题解,前面的太简单,写下来也没有意义 12.查找尤金•奧尼爾EUGENE O'NEILL得獎的所有細節 Find all details of the prize won by EU ...
- SQLZOO网页中SQL的答案(SELECT from nobel篇)
SELECT from nobel篇 1. 更改查詢以顯示1950年諾貝爾獎的獎項資料. 答案: SELECT yr, subject, winner FROM nobel WHERE yr = 19 ...
- 教你用python写:HDU刷题神器
声明:本文以学习为目的,请不要影响他人正常判题 HDU刷题神器,早已被前辈们做出来了,不过没有见过用python写的.大一的时候见识了学长写这个,当时还是一脸懵逼,只知道这玩意儿好屌-.时隔一年,决定 ...
- 刷题记录:[De1CTF 2019]Giftbox && Comment
目录 刷题记录:[De1CTF 2019]Giftbox && Comment 一.知识点 1.sql注入 && totp 2.RCE 3.源码泄露 4.敏感文件读取 ...
随机推荐
- day23 常用模块(中)
目录 一.json&pickle模块 1 什么是序列化 2 为什么要序列化 2.1 持久保存状态 2.2 跨平台数据交互 3 如何序列化 二.shelve模块 三.configparser模块 ...
- 从零开始学Electron笔记(四)
在之前的文章我们介绍了一下Electron的这个remote模块,接下来我们继续说一下Electron的右键菜单的制作. 在我们日常我们使用的软件中都会存在右键菜单的情况,比如我们用到的浏览器,开发所 ...
- python 面向对象专题(七):异常处理
目录 python面向对象07/异常处理 1. 异常错误分类 2. 什么是异常? 3. 异常处理 4. 为什么要有异常处理 5. 异常处理的两种方式 1.if判断 2.try 6. 常见异常种类 1. ...
- picker-view、微信小程序自定义时间选择器(非官方)
picker-view自定义时间选择器 官网的自定义时间选择器比较简陋.日期不准 下面是我自己写的一个demo <view class="baseList"> < ...
- 毕业三年从月薪6K到20K
首先,声明这不是标题党,是一个真实的北漂故事! 为什么写这篇文章呢?第一,有感而发,感恩遇到的人和事,其次,希望对读这篇文章的你有所帮助 毕业那年 时间追溯到17年6月30号,那天毕业典礼,之 ...
- 什么是A站、B站、C站、D站、E站、F站、G站、HIJKLM站N站?
A站AcFun弹幕视频网,简称“A站”,成立于2007年6月,取意于Anime Comic Fun,是中国大陆第一家弹幕视频网站.A站以视频为载体,逐步发展出基于原生内容二次创作的完整生态,拥有高质量 ...
- 金三银四,资深HR给面试者的十大建议
一.提前复习好你的专业知识 专业知识是最为重要的一点,拥有了坚实的专业基础,你才能迈向成功的彼岸. 因此,面试之前,一定一定要复习好专业知识.对自己学过的知识,要做一个概括,放在脑海中.茶余饭后,复习 ...
- react实战 : 用矩阵思想做一个自适应布局容器组件
需求是这样的. 有一个需要显示若干方块型元素的小区域 数量比较少的时候显示一排 数量比较多的时候显示两排 用 grid 不好,因为当数量为奇数的时候需要两排里面的元素都乖乖的居中显示. 用 flex ...
- selenium自动爬取网易易盾的验证码
我们在爬虫过程中难免会遇到一些拦路虎,比如各种各样的验证码,时不时蹦出来,这时候我们需要去识别它来继续我们的工作,接下来我将爬取网一些滑动验证码,然后通过百度的EasyDL平台进行数据标注,创建模型, ...
- presto 转换静态catlog为动态catlog
近年来,基于hadoop的sql框架层出不穷,presto也是其中的一员.从2012年发展至今,依然保持年轻的活力(版本迭代依然很快),presto的相关介绍,我们就不赘述了,相信看官多对presto ...