GISQ: Tutorial One
A Gentle
Introduction
to
SQL
Tutorial One
CIA World Factbook
This tutorial introduces SQL as a query language. We will be
using the SELECT command on a database which consists
of a single table: cia.
Napier StudentsOthers
Open an ORACLE window and log in. All of the tables are already in place.
First obtain the data.
Exercises
Issue the command
SELECT name FROM cia;
Read the notes about this data.
Check that you have it all.
Using WHERE to filter records.
Give the names and the GDP for the countries with populations
of at least 200 million (200000000)
Give the names and the per capita
GDP for the countries with populations
of at least 200 million
Show the names and populations in millions for the countries
of 'South America'
Show the populations of 'France', 'Germany', 'Italy'
Which countries have names including the word 'United'?
Using nested SELECT.
Which countries have populations larger than 'United States'
List the countries of the regions containing 'Ukraine', 'Hungary'
Show the European countries with a per capita GDP greater than
'United Kingdom'
Using SUM, COUNT, MAX, AVG, DISTINCT and ORDER BY.
Show the total population of the world.
List all the regions.
List the countries which have a GDP greater than the whole
of Africa
Using GROUP BY and HAVING.
For each region show the number
of countries of at least 10 million.
List the regions with total populations of at least 100 million.
Wyszukiwarka
Podobne podstrony:
tut1 4gui tut1tut1 1tut1 1tut1 4tut1 2tut1 4tut1 3TUT1tut1 1tut1ED!TUT1tut1 5tut1 2Tut1Tut1tut1 2tut1 3tut1 3więcej podobnych podstron