美文网首页
【SQL】7.SQLZOO练习2--SELECT from WO

【SQL】7.SQLZOO练习2--SELECT from WO

作者: 一曈 | 来源:发表于2017-06-05 13:13 被阅读190次

    题目链接:https://sqlzoo.net/wiki/SELECT_from_WORLD_Tutorial

    1
    select name,continent,population from world
    
    2
    select name from world
    where population > 200000000
    
    3
    select name,gdp/population from world where population > 200000000
    
    4
    select name,population/1000000 from world where continent = 'South America'
    
    5
    select name,population from world where name in ('France','Germany','Italy')
    
    6
    select name from world where name like '%United%'
    
    7
    select name,population,area from world 
    where area > 3000000 or population > 250000000
    
    8
    select name,population,area from world
    where (area > 3000000 and population <250000000) 
    or (area < 3000000 and population >250000000)
    
    9
    select name,round(population/1000000,2),round(gdp/1000000000,2)
    from world where continent = 'South America'
    
    10
    select name,round(gdp/population,-3) from world where gdp>1000000000000
    
    11
    SELECT name,capital FROM world
    WHERE LENGTH(name)=LENGTH(capital)
    
    12
    SELECT name, capital FROM world
    where left(name,1)= left(capital,1) and name<>capital
    
    13
    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 '% %'
    

    相关文章

      网友评论

          本文标题:【SQL】7.SQLZOO练习2--SELECT from WO

          本文链接:https://www.haomeiwen.com/subject/miuifxtx.html