123456789101112131415161718192021222324252627282930313233 |
- -- Show the name and population in millions for the countries of the continent 'South America'.
- -- Divide the population by 1000000 to get population in millions.
-
- SELECT name, population/1000000
- AS popMillions, continent
- FROM world;
-
- -- Show the countries which have a name that includes the word 'United'
-
- SELECT name
- FROM countries
- WHERE name %like% 'United';
-
- -- Show the countries that are big by area or big by population. Show name, population, and area.
-
- SELECT name, population, area
- FROM world
- WHERE area > 3000000
- OR population > 250000000;
-
- -- For South America, show population
- -- not correct
-
- SELECT name, gdp
- AS popMillions, gdp/1000000000
- FROM world
- WHERE continent = 'South America';
-
- -- Show the name and capital where the name and the captial have the same number of characters
-
- SELECT name, capital
- FROM world
- WHERE length(name) = length(capital)
|