注册 登录
编程论坛 SQL Server论坛

請問如何在分類情況下查詢出正確答案 求解

adazhang812 发布于 2018-01-31 15:53, 2502 次点击
只有本站会员才能查看附件,请 登录
表的樣子 表名 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  
請大家幫我解答謝謝
6 回复
#2
adazhang8122018-01-31 15:54
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.
這個是題目
#3
mywisdom882018-01-31 17:28
原来的数据是什么
你要的数据是什么
#4
adazhang8122018-01-31 19:02
回复 3楼 mywisdom88
綠色的就是原來的數據
答案就是白色圖片的部分   
#5
adazhang8122018-01-31 19:03
說錯了  
只有本站会员才能查看附件,请 登录
這個是 原表
#6
adazhang8122018-01-31 19:03
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.
這個是題目  
#7
adazhang8122018-01-31 19:04
只有本站会员才能查看附件,请 登录
這個是答案 只有答案 沒有 過程 所以想在想知道怎麽解答 解答過程 謝謝
1