Skip to content

Joining Data with SQL

Here you can access every table used in the course. To access each table, you will need to specify the world schema in your queries (e.g., world.countries for the countries table, and world.languages for the languages table).


Note: When using sample integrations such as those that contain course data, you have read-only access. You can run queries, but cannot make any changes such as adding, deleting, or modifying the data (e.g., creating tables, views, etc.).

Take Notes

Add notes about the concepts you've learned and SQL cells with queries you want to keep.

Add your notes here

Spinner
DataFrameas
df1
variable
SELECT *
FROM public.books
WHERE year BETWEEN 2015 AND 2019
Spinner
DataFrameas
df2
variable
SELECT *
FROM public.books
WHERE year IN (2009, 2012, 2014)

Spinner
DataFrameas
world_info
variable
-- Add your own queries here
SELECT name AS country, code, region, basic_unit
FROM world.countries
FULL JOIN world.currencies
USING (code)
WHERE region = 'North America' OR name IS NULL
ORDER BY region
Spinner
DataFrameas
df
variable
-- Select the 10 most popular colors from all parts
SELECT colors.name, COUNT(*)
FROM inventory_parts
	INNER JOIN colors
    	ON inventory_parts.color_id = colors.id
GROUP BY colors.name
ORDER BY COUNT(*) DESC
LIMIT 10
Spinner
DataFrameas
df3
variable
SELECT *
FROM dvdrentals.rental
LIMIT 3
Spinner
DataFrameas
df4
variable
SELECT *
FROM dvdrentals.customer LIMIT 5
Spinner
DataFrameas
df5
variable
SELECT * FROM dvdrentals.inventory LIMIT 5
Spinner
DataFrameas
df6
variable
SELECT * FROM dvdrentals.film LIMIT 5
Spinner
DataFrameas
language
variable
SELECT * FROM dvdrentals.language