欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-11-21 19:51:33
下面是我学习sql语句中的出错的和疑问,算是总结。 8. exclusive or (xor). show the countries that are big by area or big by...

下面是我学习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))

有没有更简单的写法?