| 网站首页 | 业界新闻 | 群组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 编程论坛
大量收QQ微信精准粉/交友粉,非诚勿扰千里之行 始于足下
共有 950 人关注过本帖
标题:請問如何在分類情況下查詢出正確答案 求解
取消只看楼主 加入收藏
adazhang812
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2018-1-31
结帖率:0
  已结贴   问题点数:20  回复次数:5   
請問如何在分類情況下查詢出正確答案 求解
表的樣子 表名 world
 正確答案   
select name, population, area
from world
where area in
(select max(area)
from world
group by continent)
or
population in (select max(population)
from world
group by continent)
這是我寫的  沒有表現出  but not both
而且比正確答案少了一種name  
請大家幫我解答謝謝
附件: 您没有浏览附件的权限,请 登录注册
2018-01-31 15:53
adazhang812
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2018-1-31
  得分:0 
Exclusive OR (XOR). Show the countries that are big by area or big by population but not both. Show name, population and area.

Australia has a big area but a small population, it should be included.
Indonesia has a big population but a small area, it should be included.
China has a big population and big area, it should be excluded.
United Kingdom has a small population and a small area, it should be excluded.
這個是題目
2018-01-31 15:54
adazhang812
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2018-1-31
  得分:0 
回复 3楼 mywisdom88
綠色的就是原來的數據
答案就是白色圖片的部分   
2018-01-31 19:02
adazhang812
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2018-1-31
  得分:0 
說錯了   這個是 原表
附件: 您没有浏览附件的权限,请 登录注册
2018-01-31 19:03
adazhang812
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2018-1-31
  得分:0 
Exclusive OR (XOR). Show the countries that are big by area or big by population but not both. Show name, population and area.

Australia has a big area but a small population, it should be included.
Indonesia has a big population but a small area, it should be included.
China has a big population and big area, it should be excluded.
United Kingdom has a small population and a small area, it should be excluded.
這個是題目  
2018-01-31 19:03
adazhang812
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2018-1-31
  得分:0 
這個是答案 只有答案 沒有 過程 所以想在想知道怎麽解答 解答過程 謝謝
附件: 您没有浏览附件的权限,请 登录注册
2018-01-31 19:04







关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019768 second(s), 9 queries.
Copyright©2004-2018, BCCN.NET, All Rights Reserved