zoukankan      html  css  js  c++  java
  • mysql---SQLZOO:从WORLD选择教程/ zh

    名称大陆人口gdp
    阿富汗 亚洲 652230 25500100 20343000000
    阿尔巴尼亚 欧洲 28748 2831741 12960000000
    阿尔及利亚 非洲 2381741 37100000 188681000000
    安道尔 欧洲 468 78115 3712000000
    安哥拉 非洲 1246700 20609294 100990000000
    ...

    名称:国家名称
    大陆:洲份
    面积:面积
    人口:人口
    gdp:国内生产总值

    国家概况

    在这教程中,我们会使用SELECT语句,对World表格进行查询。


    Show the name and the continent - but substitute Eurasia for Europe and Asia; substitute America - for each country in North America or South America or Caribbean. Show countries beginning with A or B

    显示名称和大陆 - 但以欧亚和欧洲替代欧洲和亚洲; 替代美国 - 北美 或南美洲加勒比地区的每个国家。显示以A或B开头的国家

    SELECT name,
    CASE WHEN continent IN('Europe','Asia')
         THEN 'Eurasia'
         WHEN continent IN('North America','South America','Caribbean')
         THEN 'America'
         ELSE continent END
    FROM world
    WHERE name LIKE 'A%' OR name LIKE 'B%';


    Put the continents right...

    • Oceania becomes Australasia
    • Countries in Eurasia and Turkey go to Europe/Asia
    • Caribbean islands starting with 'B' go to North America, other Caribbean islands go to South America
    Show the name, the original continent and the new continent of all countries.

    把大陆放在正确的位置...

    • 大洋洲成为大洋洲
    • 欧亚和土耳其的国家去欧洲/亚洲
    • 以'B' 开头的加勒比群岛去北美,其他加勒比群岛去南美洲
    显示所有国家的名称,原始大陆和新大陆。
     
    SELECT name,continent,
    CASE WHEN continent IN ('Eurasia', 'Turkey')
         THEN 'Europe/Asia'
         WHEN continent = 'Oceania' 
         THEN 'Australasia'
         WHEN continent = 'Caribbean'
              THEN
              CASE 
              WHEN name LIKE 'B%' 
              THEN 'North America'
              ELSE 'South America'
              END
         ELSE continent 
         END
    FROM world
    ORDER BY name ASC;

  • 相关阅读:
    阿里巴巴开源的Asynchronous I/O Design and Implementation
    maven 出现错误 -source 1.5 中不支持 diamond 运算符
    Kafka设计解析(六)- Kafka高性能架构之道
    Kafka设计解析(七)- Kafka Stream
    flink如何动态支持依赖jar包提交
    Hbase技术笔记
    windows环境:idea或者eclipse指定用户名操作hadoop集群
    HBase源码实战:BufferedMutator
    HBase工具:如何查看HBase的HFile
    HBase源码实战:CreateRandomStoreFile
  • 原文地址:https://www.cnblogs.com/tk55/p/6751736.html
Copyright © 2011-2022 走看看