MySQL Basics: Select Exercises
The US Government organizes and publishes online a publically accessible database of various information and statistics organized by country. Each year, a new version of the "CIA Worldfactbook" is made available. Via the website (https://www.cia.gov/cia/publications/factbook/index.html) it's possible to download the lot as a big zip of HTML files. Handy for planning your next coup when out of range of an Internet connection, but much more interesting would be to do retrieval / summarizing with SQL...
Happily, using the open source wfb2sql script, http://wfb2sql.sourceforge.net/, it's possible to convert / scrape these HTML files into SQL suitable for "sourcing" into your very own MySQL database.
A sample resulting database (based on 2004 data):
- attachment:factbook2004.sql.gz
Download the MySQL handouts! (8 pages) [1]
Exercises
- attachment:SQLSelectExercises1.pdf
- attachment:SQLSelectExercises2.pdf