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
.zipfile 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
psqlinteractive terminal:$ psql -
Create a database named
carmenand connect to it:CREATE DATABASE carmen; \c carmen -
Create
city,country&countrylanguagetables 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 tablenamecommands 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.