NOT IN vs IN Do Not Return Complimentary Results

后端 未结 4 1027
灰色年华
灰色年华 2021-02-11 10:03

Hi I am working through example #7 from the sql zoo tutorial: SELECT within SELECT. In the following question

\"Find each country that belongs to a continent where all p

4条回答
  •  没有蜡笔的小新
    2021-02-11 10:34

    Because every other continent has at least one country with less then 25 Mio population. That is what this says.

      SELECT name, continent, population FROM world 
    WHERE continent IN (
        SELECT continent FROM world
        WHERE population < 25000000)
    

    Translating it into words: From the list of all countries (in table world) please find all countries where the continent has a country that has less than 25 Mio population.

提交回复
热议问题