数据璐SQL零基础入门教程学习一共10天 练习题合集

本文是一份SQL零基础入门的学习教程,涵盖了从基础的`select`和`from`用法,到`where`条件筛选,再到聚合函数、`group by`、`having`,以及`order by`、`limit`、子查询、表连接、常用函数、窗口函数等多个知识点,并提供了丰富的练习题和解答,适合SQL初学者进行自我提升。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  •  
    • 主知识点一: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)
    • 主知识点三:聚合函数、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
    • 主知识点四:order by
      • 【1】点击链接
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值