SQL Review: Simple SELECT Queries
Practice everything you've learned so far with a new dataset of North American cities.
SQL Review: Simple SELECT Queries
You've done a good job getting to this point! Now that you've gotten a taste of how to write a basic query, you need to practice writing queries that solve actual problems.
Exercise
In the exercise below, you will be working with a different table. This table instead contains information about a few of the most populous cities of North America including their population and geo-spatial location in the world.
Did you know?
Positive latitudes correspond to the northern hemisphere, and positive longitudes correspond to the eastern hemisphere. Since North America is north of the equator and west of the prime meridian, all of the cities in the list have positive latitudes and negative longitudes.
Try and write some queries to find the information requested in the tasks below. You may have to use a different combination of clauses in your query for each task. Once you're done, continue onto the next lesson to learn about queries that span multiple tables.
Table: north_american_cities
Review 1 — Tasks
- List all the Canadian cities and their populations
- Order all the cities in the United States by their latitude from north to south
- List all the cities west of Chicago, ordered from west to east
- List the two largest cities in Mexico (by population)
- List the third and fourth largest cities (by population) in the United States and their population
Solve all tasks to continue to the next lesson.