永发信息网

sql语句:在每个大洲里面,找出面积最大的国家。

答案:3  悬赏:70  手机版
解决时间 2021-03-27 02:47
  • 提问者网友:树红树绿
  • 2021-03-26 13:59
sql语句:在每个大洲里面,找出面积最大的国家。
最佳答案
  • 五星知识达人网友:独钓一江月
  • 2021-03-26 14:40
你描述那个是第6题
select a.continent,a.name,a.area from world as a,
(select continent,max(area) as area from world group by continent) as b where a.continent=b.continent
and a.area=b.area

你把第7第8给翻译一下呗追问7.找出属于某一个大洲的每一个国家,前提是,属于这个大洲的所有国家的人口都没超过25000000。 结果给出name continentand population.
8.在同属于某个大洲的国家中,其中一个国家的人口是其余任意一个个国家的三倍以上
找出这些国家和它所属的大洲。给出 countries and continents.
翻译的够清楚了。追答7.
select name,continent,population from world where
continent in
(select b.continent from
(select continent,count(*) counts
from world where population <25000000
group by continent) b,
(select continent,count(*) counts
from world group by continent) c
where b.continent=c.continent
and b.counts=c.counts)

-------------
8.
select name,continent from world
where continent in
(select t2.continent from
(select c.continent,count(*) counts
from
(select b.continent,b.name from
(select * from world) a,
(select * from world) b
where
a.continent=b.continent and
a.population>=3*b.population
group by b.continent,b.name) c
group by c.continent) t2,
(select continent,count(*) counts
from world group by continent) t3
where t2.continent=t3.continent
and t2.counts=t3.counts-1)
and name not in
(select b.name from world a,world b where
a.continent=b.continent
and a.population>=3*b.population
group by b.name)
---------
也不知道你问没问第五题,顺便给你吧
select name from
world where gdp >
(select max(gdp)from world where continent = 'Europe')
and continent <> 'Europe'
全部回答
  • 1楼网友:躲不过心动
  • 2021-03-26 16:03
select name,continent,area
from world
group by continent,name,area having population<25000000

7题
  • 2楼网友:玩世
  • 2021-03-26 15:41
select name From table where gdp = (
select max(gdp)
from table where continent = 'Europe')
and continent = 'Europe'
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯