0

显示的查询包含一个 JOIN t the world 表,因此我们可以访问每个国家的总人口并计算感染率(以每 100,000 例为单位)。

显示每个国家的感染率排名。仅包括人口至少为 1000 万的国家。

答。

SELECT world.name,
       ROUND(100000*confirmed/population,00) as rd,
       rank() over (order by rd)
FROM covid 
   JOIN world ON covid.name=world.name
WHERE whn = '2020-04-20' 
  AND population > 10000000
ORDER BY population DESC

上面的代码是我的解决方案,但我仍然得到错误的答案。有谁知道正确的解决方案?

4

1 回答 1

1

此处确认感染率/人口;所以查询是-

SELECT world.name,
       ROUND(100000*confirmed/population,0),
       RANK() OVER (ORDER BY confirmed/population) AS rank
FROM covid JOIN world ON covid.name=world.name
WHERE whn = '2020-04-20' AND population > 10000000
ORDER BY population DESC
于 2020-07-06T15:33:33.013 回答