zoukankan      html  css  js  c++  java
  • SUM and COUNT -- SQLZOO

    SUM and COUNT

    注意:where语句中对表示条件的需要用单引号, 下面的译文使用的是有道翻译如有不正确,请直接投诉有道

     01.Show the total population of the world.

    译文:展示世界总人口。

    SELECT SUM(population) FROM world

    02.List all the continents - just once each.

    译文:列出所有的大陆——每个大陆只列出一次。

    SELECT DISTINCT continent FROM world

    03.Give the total GDP of Africa

    译文:看看非洲的GDP总量

    SELECT SUM(gdp) FROM world WHERE continent = 'Africa'

    04.How many countries have an area of at least 1000000

    译文:有多少国家的面积至少有100万。

    SELECT COUNT(name) FROM world WHERE area >= 1000000

    05.What is the total population of ('Estonia', 'Latvia', 'Lithuania')

    译文:爱沙尼亚、拉脱维亚、立陶宛的总人口是多少?

    SELECT SUM(population) FROM world WHERE name IN ('Estonia', 'Latvia', 'Lithuania')

    06.For each continent show the continent and number of countries.

    译文:表示每个洲的洲数和国家数。

    SELECT continent, COUNT(name) FROM world GROUP BY continent

    07.For each continent show the continent and number of countries with populations of at least 10 million.

    译文:每一洲显示人口至少为1 000万的洲和国家数目。

    SELECT continent, COUNT(name) FROM world WHERE population > 10000000 GROUP BY continent

    08.List the continents that have a total population of at least 100 million.

    译文:列出总人口至少为1亿的大洲。

    SELECT continent FROM world GROUP BY continent HAVING SUM(population) >= 100000000

    练习网址:https://sqlzoo.net/wiki/SUM_and_COUNT

    ------------------------------------------------------------------------------------------------------------------------------------------------------------------

  • 相关阅读:
    ssh连接虚拟机centos
    centos安装vim
    CentOS 使用yum命令安装出现错误提示”could not retrieve mirrorlist http://mirrorlist.centos.org
    java多线程之yield,join,wait,sleep的区别
    mybatis分页插件pagehelper
    kaptcha验证码插件使用与参数
    redis主从简单配置
    从本地新建项目到提交到github
    Linux服务器安装rocketMQ单机消息队列
    Oracle通过命令导入数据存储文件
  • 原文地址:https://www.cnblogs.com/yanzhongyixu/p/13394312.html
Copyright © 2011-2022 走看看