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.敏感文件读取 ...
随机推荐
- Python函数05/内置函数/闭包
Python函数05/内置函数/闭包 目录 Python函数05/内置函数/闭包 内容大纲 1.内置函数(二) 2.匿名函数及内置函数(重要) 3.闭包 4.今日总结 5.今日练习 内容大纲 1.内置 ...
- hihoCoder 1049 后序遍历 最详细的解题报告
题目来源:后序遍历 解题思路:开始时我只知道先通过先序.中序求出二叉树,然后再后序遍历二叉树,这当然也是一种解题思路,但是会做一些无用功,比如:计算二叉树.其实,可以直接通过先序序列和中序序列直接求出 ...
- 1731: [Usaco2005 dec]Layout 排队布局*
1731: [Usaco2005 dec]Layout 排队布局 题意: n头奶牛在数轴上,不同奶牛可以在同个位置处,编号小的奶牛必须在前面.m条关系,一种是两头奶牛距离必须超过d,一种是两头奶牛距离 ...
- MVC + EFCore 项目实战 - 数仓管理系统5 – 菜单配置及里程碑划分
上次课程我们完成了需求的梳理. 我们根据梳理的需求把菜单配好,另外我们把项目里程碑也配置在系统中,开发和管理都在系统中,形成无文档化管理. 一.菜单配置 根据我们的归纳图,我们先将菜单配置好. 我们遵 ...
- DEX文件解析--3、dex文件字符串解析
一.前言 前两篇文章链接: 1.DEX文件头解析 2.DEX文件校验和解析 PS:前几天检查文件夹的时候发现DEX文件解析还只写了开头,正好找点事情来做,就去接着解析DEX ...
- Ethical Hacking - NETWORK PENETRATION TESTING(24)
Detecting suspicious activities using Wireshark You can use make the MAC address of the router to st ...
- 《2020版Linux云计算学习图谱》帮你提升80%专业技能,在线免费领
2亿人在家办公.视频会议的需求,给钉钉后台系统带来巨大压力.据了解,钉钉在通过阿里云紧急扩容1万台服务器后,再度扩容1万台云服务器. 受疫情影响,在家办公需求暴涨.从29号开始到2月6日,腾讯会议每天 ...
- corosync+pacemaker高可用集群
高可用集群,是指以减少服务中断(如因服务器宕机等引起的服务中断)时间为目的的服务器集群技术.简单的说,集群就是一组计算机,它们作为一个整体向用户提供一组网络资源.这些单个的计算机系统就是集群的节点. ...
- springMVC -- 对接UEditor(富文本编辑器)
工作中需要用到UEditor编辑文本,在与springMVC进行整合时,出现了一些问题,结果导致,在进行图片上传时出现如下提示: 上网查询了很多相关资料,此处简要记录下,防止以后遇到类似问题. 一种方 ...
- 一文入门DNS?从访问GitHub开始
前言 大家都是做开发的,都有GitHub的账号,在日常使用中肯定会遇到这种情况,在不修改任何配置的情况下,有时可以正常访问GitHub,有时又直接未响应,来一起捋捋到底是为啥. GitHub访问的千层 ...