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.敏感文件读取 ...
随机推荐
- day11 文件操作(上)
目录 一.什么是文件 二.为何要用文件 三.如何使用文件 3.1文件操作的基本流程 3.2资源回收with上下文管理 3.3指定操作文本的字符编码 四.文件的操作模式 4.1控制文件读写操作的模式(t ...
- Pop!_OS安装与配置(一):下载安装
Pop!_OS安装过程 0x0 Pop!_OS简介 0x1 下载 0x2 启动盘制作 0x3 重启安装 如何分区 0x4 重启进入Pop!_OS 0x0 Pop!_OS简介 Linux发行版选哪个? ...
- 基于NeteaseCloudMusicApi和electron-vue开发网易云音乐--electron-vue初始化
本机环境: nodejs v12.16.3 npm 6.14. vue-cli 4.3. 初始化项目 vue init simulatedgreg/electron-vue my-project // ...
- 数据可视化之powerBI入门(九)PowerBI数据建模:其实一点都不高深
https://zhuanlan.zhihu.com/p/64149834 数据建模并没有那么高深,你同样可以学会!这篇文章通过一个实例创建一个简单的数据建模,并引出两个重要的概念:度量值和DAX. ...
- 数据可视化之PowerQuery篇(五)PowerQuery文本处理技巧:移除和提取
https://zhuanlan.zhihu.com/p/64419762 每当拿到原始数据,不如意十有八九,快速准确的清洗数据也是必备技能,数据清洗正好是 PowerQuery 的强项,本文就来介绍 ...
- Python: 如何判断远程服务器上Excel文件是否被人打开
最近工作中需要去判断远程服务器上的某个Excel文件是否被打开,如果被人打开,则等待,如果没人打开使用,则去填写数据进Excel文件. 开始想的很简单,和其他语言一样,比如C#,打开文件,如果报错说明 ...
- C#根据反射动态创建ShowDoc接口文本信息
我目前每天主要工作以开发api为主,这都离不开接口文档.如果远程对接的话前端总说Swagger不清晰,只能重新找一下新的接口文档.ShowDoc就是一个不错的选择,简洁.大方.灵活部署. 但是话说回来 ...
- nginx 信号管理
本内容只针对nginx 关闭操作罗列方法技巧,不废话直接写,Nginx的信号控制如下: 1. TERM, INT 强制关闭进程 查看nginx进程ps -aux|grep nginx root 8 ...
- python基础算法
一.简介 定义和特征 定义:算法(Algorithm)是指解题方案的准确而完整的描述,是一系列解决问题的清晰指令,算法代表着用系统的方法描述解决问题的策略机制.也就是说,能够对一定规范的输入,在有限时 ...
- 地图热点 jquery.image-maps.js 的使用
在我悠闲了几天之后,我们后端给了我个任务,地图热点问题.简单来说,就是后台划出热点区域,设置链接,前端拿到数据渲染页面,显示热点区域.我主要使用了jquery.image-maps.js,并且添加了一 ...