我该如何解决这个查询 [英] how can i solve this Query

查看:77
本文介绍了我该如何解决这个查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个大陆都显示该大陆和人口数量至少为1000万的国家数量。



世界(姓名,大陆,地区,人口,gdp)



我的答案是:

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

world(name, continent, area, population, gdp)

my answer is :

select continent, count(name) from world
group by continent
having Min(population)>=10000000



什么是正确的Anwer?!



编辑:转到GimmeCodezz / Homework部分。 - Marco Bertschi


what is the Correct Anwer?!

moved over to the GimmeCodezz/Homework section. - Marco Bertschi

推荐答案

你的查询是正确的,因为它只是一件事是不对的。



只有在想要对集合函数执行某些操作时才需要having子句,例如:sum(X),min(Y),count(Z)等...这是在这种情况下不需要。一个简单的where子句就足够了 - 尝试这样做,如果你仍然无法使它工作,请回到我们身边。
Your query is just about correct as it stands... just one thing isn''t quite right.

The "having" clause is only required when you are wanting to perform some operation over set functions, eg: sum(X), min(Y), count(Z) etc... this is not required in this case. A simple where clause will suffice - try doing that and get back to us if you still can''t get it working.


这篇关于我该如何解决这个查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆