A Gentle Introduction to

SQL


Pick an engine:

CIA World Factbook

This tutorial introduces SQL as a query language. We will be using the SELECT command on the table cia:

cia(name, region, area, population, gdp)

Exercises

Using the SELECT statement.

1a Read the notes about this table. Issue the command: SELECT name, region, population FROM cia. Look at the output.

Before attempting the following questions read this! How to use WHERE to filter records.

2a Show the name for the four countries that have a population of at least 200 million. (200 million is 200000000, there are eight zeros)

2b Give the name and the per capita GDP for those countries with a population of at least 200 million.
Per capita GDP

2c Show the name and population in millions for the countries of 'South America'

2d Show the population for 'France', 'Germany', 'Italy'

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

That's enough for the first tutorial. The next tutorial concerns nested SELECT statements using the same cia table.