SELECT from MONDE

From SQLZOO
Revision as of 14:02, 20 December 2012 by Bricec (Talk | contribs)

Jump to: navigation, search
namecontinentarea populationgdp
AfghanistanAsia6522302550010020343000000
AlbaniaEurope28748 2831741 12960000000
AlgeriaAfrica2381741 37100000 188681000000
AndorraEurope46878115 3712000000
AngolaAfrica1246700 20609294 100990000000
...

Contents

Profile de pays

Dans ce tutoriel, nous utiliserons l'instruction SELECT sur la table World:

Résumé

Echauffement

Lire les notes à propos de cette table. Observer le résultat de cette commande SQL simple.

SELECT name, continent, population FROM world
SELECT name, continent, population FROM world

Pays largement peuplés

How to use WHERE to filter records.

Afficher le nom des pays qui ont une population d'au moins 200 million d'habitants. (200 million c'est 200000000, il y a 8 zéros)

SELECT name FROM world
WHERE population>250000000
SELECT name FROM world
WHERE population>200000000


Donner le nom et le PIB par habitant pour les pays dont le nombre d'habitants est au moins 200 million.

le PIB par habitant est le PIB divisé par la population

 
SELECT name, gdp/population FROM world
  WHERE population > 200000000

Show the name and population in millions for the countries of 'South America' Divide the population by 1000000 to get population in millions.

 
SELECT name, population/1000000 FROM world
  WHERE continent='South America'

Show the name and population for 'France', 'Germany', 'Italy'

 
SELECT name, population FROM world
  WHERE name IN ('France','Germany','Italy')

Identify the countries which have names including the word 'United'

 
SELECT name FROM world
  WHERE name LIKE '%United%'
Clear your results

What Next

Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense