My brother recommended I might like this website. He was totally right. This post truly made my day. You cann't imagine simply how much time I had spent for this info! Thanks! fdadbfgafacdabek
Per Capita GDP
population/areafor each country where the area is over 5,000,000 km2.
gdp/populationfor each country where the area is over 5,000,000 km2
SELECT name, population/area FROM world WHERE area > 5000000
SELECT name, gdp/population FROM world WHERE area > 5000000
Small and wealthy
Where to find some very small, very rich countries.
AND to ensure that two or more conditions hold
SELECT name , continent FROM world WHERE population < 2000000 AND gdp > 5000000000
SELECT name , continent FROM world WHERE area < 2000 AND gdp > 5000000000
Checking a list The word IN allows us to check if an item is in a list. The example shows the name and population for the countries 'Ireland', 'Iceland' and 'Denmark'
SELECT name, population FROM world WHERE name IN ('Ireland', 'Iceland', 'Denmark')
SELECT name, population FROM world WHERE name IN ('Denmark', 'Finland', 'Norway', 'Sweden')
Starts with G
What are the countries beginning with G?
LIKE permits pattern matching - % is the wildcard.
The examples shows countries beginning with D
SELECT name FROM world WHERE name LIKE 'D%'
SELECT name FROM world WHERE name LIKE 'G%'
Just the right size
Which countries are not too small and not too big? Show the country and the area for countries with an area between 207600 and 244820.
BETWEEN allows range checking - note that it is inclusive.
SELECT name, area FROM world WHERE area BETWEEN 207600 AND 244820...
SELECT name, area/1000 FROM world WHERE area BETWEEN 207600 AND 244820
You are ready for tutorial one:SELECT statements with WHERE.
|Language:||English • Deutsch|