美文网首页
SQLZoo:Percentages of Germany

SQLZoo:Percentages of Germany

作者: Jianbaozi | 来源:发表于2020-12-17 16:28 被阅读0次
    image.png

    Germany (population 80 million) has the largest population of the countries in Europe. Austria (population 8.5 million) has 11% of the population of Germany.

    Show the name and the population of each country in Europe. Show the population as a percentage of the population of Germany.

    The format should be Name, Percentage for example:

    name percentage
    Albania 3%
    Andorra 0%
    Austria 11%

    select name,concat(round(( 100* population /
     (select population from world  where name = 'Germany')),0),'%') 
    as pecent from world where continent='Europe';
    

    相关文章

      网友评论

          本文标题:SQLZoo:Percentages of Germany

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