Sample database based on the data from the Netflix Engagement Report and the Netflix Global Top 10 weekly list, it includes movies and TV shows for learning and practice purposes.
- MySQL
- Oracle
- PostgreSQL
- SQLite
- SQL Server
Download the SQL scripts from the latest release assets. One or more SQL script files are provided for each database vendor supported. You can run these SQL scripts with your preferred database tool.
- https://about.netflix.com/en/news/what-we-watched-the-first-half-of-2024
- https://about.netflix.com/en/news/what-we-watched-the-second-half-of-2023
- https://www.netflix.com/tudum/top10
-- Movies released since 2024-01-01
select id, title, runtime from movie where release_date >= '2024-01-01';
-- TV Show Seasons released since 2024-01-01
select s.id, s.title as season_title, s.season_number, t.title as tv_show, s.runtime
from season s left join tv_show t on t.id = s.tv_show_id
where s.release_date >= '2024-01-01';
-- Top 10 movies (English)
select v.view_rank, m.title, v.hours_viewed, m.runtime, v.views, v.cumulative_weeks_in_top10
from view_summary v
inner join movie m on m.id = v.movie_id
where duration = 'WEEKLY'
and start_date = '2024-12-09'
and m.locale = 'en'
order by v.view_rank asc;
-- Engagement report
select m.title, m.original_title, m.available_globally, m.release_date, v.hours_viewed, m.runtime, v.views
from view_summary v
inner join movie m on m.id = v.movie_id
where duration = 'SEMI_ANNUALLY'
and start_date = '2024-01-01'
order by v.view_rank asc;
- The application is a Spring Boot application that uses Spring Data JPA / Hibernate Object/Relational Mapping framework.
- The database schema is defined in these entity classes, and it gets auto-generated when the application starts up.
- After start-up, the application uses Spring Batch to run a batch job to populate the database based on the Netflix spreadsheet reports, and then exports the database schema and data to a SQL script.
- JDK 21, for example: Amazon Corretto 21, Oracle OpenJDK 21, MS OpenJDK 21, etc.
- Docker Desktop
Start the database containers:
docker compose up -d
Generate the SQL Scripts:
./build.sh
The generated SQL scripts will be in the build/artifacts
folder:
open ./build/artifacts