-
- 主知识点一:select&from
- 自己完整敲一遍知识点中出现的代码吧~
- 主知识点二:where
- 【1】SELECT from WORLD Tutorial - SQLZOO第四题
- 【题目】
- 查询南美洲(south america)所有国家的名称以及它们以百万(1000000 )为单位的人口数量
- 【正确答案】
- select
- name
- , population/1000000 population_in_millions
- from world
- where continent = 'South America';
- 【题目】
- 【2】SELECT from Nobel Tutorial - SQLZOO第九题
- 【题目】
- 查询1980年除诺贝尔化学奖和诺贝尔医学奖外其余奖项获奖者的所有信息。
- 【正确答案】
- select *
- from nobel
- where yr = 1980
- and subject not in ('Chemistry','Medicine')
- 【题目】
- 【3】SELECT from WORLD Tutorial - SQLZOO第十三题
- 【题目】
- 查询既包含有所有元音字母(a,e,i,o,u),同时国家名中没有空格的国家,最后显示他们的名字
- 例如,赤道几内亚Equatorial Guinea 和 多米尼加共和国Dominican Republic ,都包括有五个元音字母(a,e,i,o,u),但这些国家不会被记录,因为国家名中,由两个单词构成(有空格)
- 【正确答案】
- select name
- from world
- where name like '%a%'
- and name like '%e%'
- and name like '%i%'
- and name like '%o%'
- and name like '%u%'
- and name not like '% %';
- 【题目】
- 【4】SELECT from Nobel Tutorial - SQLZOO第十题
- 【题目】
- 查询1910年以前(不含1910)诺贝尔医学奖获得者和2004年及以后诺贝尔文学奖获得者的所有信息
- 【正确答案】
- select *
- from nobel
- where (subject = 'Medicine' and yr < 1910)
- or (subject = 'Literature' and yr >= 2004)
- 【题目】
- 【1】SELECT from WORLD Tutorial - SQLZOO第四题
- 主知识点三:聚合函数、group by&having
- 【1】SUM and COUNT - SQLZOO第五题
- 【题目】
- 计算Estonia, Latvia, Lithuania这几个国家的总人口数
- 【正确答案】
- select sum(population)
- from world
- where name in ('Estonia', 'Latvia', 'Lithuania')
- 【题目】
- 【2】SUM and COUNT - SQLZOO第七题
- 【题目】
- 查询每个大洲和该大洲里人口数超过1千万的国家的数量
- 【正确答案】
- select
- continent
- ,count(name) 'number of countries'
- from world
- where population >= 10000000
- group by continent
- 【题目】
- 【1】SUM and COUNT - SQLZOO第五题
- 主知识点四:order by
- 【1】点击链接
- 主知识点一:select&from
数据璐SQL零基础入门教程学习一共10天 练习题合集
于 2022-04-22 15:10:59 首次发布