Carmen San Diego Lab
Introduction
Use SQL to find Carmen Sandiego
We're going to use what we've learned already about querying a database using SQL commands to to chase down and capture an elusive and world-renowned thief, Carmen Sandiego!
Set Up
-
Download the starter files
-
Extract the folder from the
.zip
file and open in VS Code:$ code .
-
Open a terminal session and run
ls
. Ensure that you see the files:clues.sql
&world.sql
. -
Start the
psql
interactive terminal:$ psql
-
Create a database named
carmen
and connect to it:CREATE DATABASE carmen; \c carmen
-
Create
city
,country
&countrylanguage
tables and seed their data using the import (\i
) psql command:\i world.sql
Exercise
The goal is to figure out what city Carmen Sandiego is heading to so that she can be met by the proper authorities.
You'll be writing SQL queries within clues.sql
to answer each clue.
Run the queries in psql by typing \i clues.sql
.
Hints
-
Use the psql
\d
&\dt tablename
commands to list & display the schema of each of the three tables. -
Google and collaborate to reach the goal of finding out where Carmen's destination is.
-
For example, you'll certainly need to know about the ORDER BY. clause.
Additional Resources
Encore
If you finish this exercise and want to learn more about SQL, do some of these exercises here.