提问sqlzoo中一道题:

学SQL的小菜鸟 2019-01-06 08:08:50
sqlzoo里面有道题如下:Some countries have populations more than three times that of any of their neighbours (in the same continent). Give the countries and continents.
解答如下:
select name,continent from world x
where population >=all(select 3*y.population from world y where y.continent=x.continent and y.population>0 and x.name!=y.name)
请问:为何需要有x.name!=y.name
表:

...全文
250 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Foliole 2019-01-09
  • 打赏
  • 举报
回复
排除自己~~~~~~~~~~~
吉普赛的歌 2019-01-08
  • 打赏
  • 举报
回复
中文意思: 一些国家的人口超过其它国家的三倍(同一个洲)。请列出国家和洲。 自己与其它国家相比, 当然得去掉自己。
wwfxgm 2019-01-08
  • 打赏
  • 举报
回复
sqlzoo 是什么东东?
二月十六 2019-01-07
  • 打赏
  • 举报
回复
应该是把自己刨除在外吧

22,302

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧