SQLZOO练习二--SELECT from Nobel Tutorial
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了SQLZOO练习二--SELECT from Nobel Tutorial,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3287字,纯文字阅读大概需要5分钟。
内容图文
![SQLZOO练习二--SELECT from Nobel Tutorial](/upload/InfoBanner/zyjiaocheng/1274/ff3ecd7bb21449b39d0c228848f147d8.jpg)
We continue practicing simple SQL queries on a single table.
This tutorial is concerned with a table of Nobel prize winners:
nobel(yr, subject, winner)
Using the SELECT
statement.
1、Winers from 1950
检索1950年的诺贝尔奖信息。
Change the query shown so that it displays Nobel prizes for 1950.
SELECT yr,subject,winner FROM nobel WHERE yr=1950;
2、1962 literature
显示1962年诺贝尔文学奖得主信息。
Show who won the 1962 prize for Literature.
SELECT winner FROM nobel WHERE yr=1962AND subject =‘Literature‘;
3、Albert Einstein
显示爱因斯坦得诺贝尔奖的时间和奖项。
Show the year and subject that won ‘Albert Einstein‘ his prize.
4、Recent Peace Prize
显示自2000年(包含2000)年至今,诺贝尔和平奖的得主。
Give the name of the ‘Peace‘ winners since the year 2000, including 2000.
SELECT winner FROM nobel WHERE subject=‘Peace‘AND yr>=2000;
5、Literature in 1980‘s
显示从1980-1989年诺贝尔文学奖的所有信息。
Show all details (yr, subject, winner) of the Literature prize winners for 1980 to 1989 inclusive.
SELECT * FROM nobel WHERE subject=‘Literature‘AND yr BETWEEN1980AND1989;
6、Only presidents
显示总统得主‘西奥多·罗斯福’,‘伍德罗·威尔逊’,‘吉米·卡特’,‘巴拉克·奥巴马’的所有信息。
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、John
显示名为‘John’的诺贝尔奖得主姓名。
Show the winners with first name John
SELECT winner FROM nobel WHERE winner LIKE‘John%‘;
8、Chemistry and Physics from different years
显示1980年诺贝尔物理学和1984年诺贝尔化学奖得主的年份,奖项,姓名。
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=1980OR subject=‘Chemistry‘AND yr=1984;
9、Exclude Chemists and medics
显示1980年诺贝尔除化学和药学之外的所有信息。
Show the year, subject, and name of winners for 1980 excluding Chemistry and Medicine
SELECT * FROM nobel WHERE yr=1980AND subject NOTIN (‘Chemistry‘,‘Medicine‘);
10、Early medicine,Later Literature
显示1910年以前(不包含1910年)医药学得奖信息和2004年后(包含2004年)的文学奖得奖信息。
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 * FROM nobel WHERE subject=‘Medicine‘AND yr <1910OR subject=‘Literature‘AND yr>=2004;
11、Umlaut
显示PETER GRüNBERG的得奖信息。
Find all details of the prize won by PETER GRüNBERG
SELECT * FROM nobel WHERE winner=‘PETER GRüNBERG‘;
12、apostrophe
显示EUGENE O‘NEILL的得奖信息。
Find all details of the prize won by EUGENE O‘NEILL
SELECT * FROM nobel WHERE winner=‘EUGENE O‘NEILL‘;
13、Knights of the realm
Knights in order
罗列以‘Sir’开头的得奖者姓名,年份,得奖项信息,年份按照最近排序,然后按照名字排序
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%‘ORDERBY yr DESC,winner;
14、Chemistry and Physics Last
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=1984ORDERBY subject IN(‘Chemistry‘,‘Physics‘),subject,winner;
原文:https://www.cnblogs.com/ruoli-121288/p/13199450.html
内容总结
以上是互联网集市为您收集整理的SQLZOO练习二--SELECT from Nobel Tutorial全部内容,希望文章能够帮你解决SQLZOO练习二--SELECT from Nobel Tutorial所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。