SQL Playground
Database adapted from a PostgreSQL database with simulated business data.
- New to SQL? Check out our SQL Course.
- Practice SQL from 18 tables from a movie rentals business 🍿, DB Schema.
- Ready for some challenges? Practice real coding questions with online judge (a paid membership is required).
- Looking to switch your career? Try our AI Career Copywriting.
col_name | col_type -------------+-------------------------- actor_id | integer first_name | text last_name | text
Actors who appeared in a movie.
col_name | col_type ------------+------------------- actor_id | integer first_name | character varying last_name | character varying
Actors who appeared in a TV show.
col_name | col_type ------------+------------------- actor_id | integer first_name | character varying last_name | character varying
col_name | col_type -------------+-------------------------- address_id | integer address | text address2 | text district | text city_id | smallint postal_code | text phone | text
Movie categories.
col_name | col_type -------------+-------------------------- category_id | integer name | text
col_name | col_type -------------+-------------------------- city_id | integer city | text country_id | smallint
col_name | col_type -------------+-------------------------- customer_id | integer store_id | smallint first_name | text last_name | text email | text address_id | smallint activebool | boolean create_date | date active | integer
Calendar dates from 01/01/2019 to 12/31/2025.
col_name | col_type ----------+---------- year | smallint month | smallint date | date
col_name | col_type ----------------------+-------------------------- film_id | integer title | text description | text release_year | integer language_id | smallint original_language_id | smallint rental_duration | smallint rental_rate | numeric length | smallint replacement_cost | numeric rating | text
Films and their casts
col_name | col_type -------------+-------------------------- actor_id | smallint film_id | smallint
A film can only belong to one category
col_name | col_type -------------+-------------------------- film_id | smallint category_id | smallint
Each row is unique, inventoy_id is the primary key of this table.
col_name | col_type --------------+-------------------------- inventory_id | integer film_id | smallint store_id | smallint
Movie rental payment transactions table
col_name | col_type --------------+-------------------------- payment_id | integer customer_id | smallint staff_id | smallint rental_id | integer amount | numeric payment_ts | timestamp with time zone
col_name | col_type --------------+-------------------------- rental_id | integer rental_ts | timestamp with time zone inventory_id | integer customer_id | smallint return_ts | timestamp with time zone staff_id | smallint
Total sales by movie categories.
col_name | col_type -------------+---------- category | text total_sales | numeric
Movie sales by store
col_name | col_type -------------+---------- store | text manager | text total_sales | numeric
col_name | col_type -------------+-------------------------- staff_id | integer first_name | text last_name | text address_id | smallint email | text store_id | smallint active | boolean username | text picture | character varying
col_name | col_type ----------+---------- id | integer name | text address | text zip code | text phone | text city | text country | text sid | smallint
Your Results