学习SQL语句中的出错的和疑问分享

下面是我学习sql语句中的出错的和疑问,算是总结。

8. 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.

select name,population,area from world
 where  ((area < 3000000 and population>250000000) or (area > 3000000 and population < 250000000))

有没有更简单的写法?

(0)
上一篇 2022年3月21日
下一篇 2022年3月21日

相关推荐