标题:請問如何在分類情況下查詢出正確答案 求解
只看楼主
adazhang812
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2018-1-31
结帖率:0
已结贴  问题点数:20 回复次数:6 
請問如何在分類情況下查詢出正確答案 求解
表的樣子 表名 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  
請大家幫我解答謝謝
搜索更多相关主题的帖子: 答案 world select from max 
2018-01-31 15:53
adazhang812
Rank: 1
等 级:新手上路
帖 子:8
专家分: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
mywisdom88
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:190
帖 子:3125
专家分:8340
注 册:2015-3-25
得分:20 
原来的数据是什么
你要的数据是什么
2018-01-31 17:28
adazhang812
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2018-1-31
得分:0 
回复 3楼 mywisdom88
綠色的就是原來的數據
答案就是白色圖片的部分   
2018-01-31 19:02
adazhang812
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2018-1-31
得分:0 
說錯了  
這個是 原表
2018-01-31 19:03
adazhang812
Rank: 1
等 级:新手上路
帖 子:8
专家分: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
等 级:新手上路
帖 子:8
专家分:0
注 册:2018-1-31
得分:0 
這個是答案 只有答案 沒有 過程 所以想在想知道怎麽解答 解答過程 謝謝
2018-01-31 19:04



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-484567-1-1.html




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

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