Short answer
SQL practice datasets to start with: Sakila or Pagila for joins, Chinook or AdventureWorks for business reports, and NYC taxi Parquet files in DuckDB for large tables. BigQuery gives 1 TiB of free queries a month on public datasets.
On this page
- Which sample database should you start with?
- Which classic sample databases are free to download?
- Where can you find large, messy public data?
- Can you query cloud sample data without loading anything?
- How do you practice locally with DuckDB and Parquet?
- Which dataset suits which database?
- What should you do after loading a dataset?
SQL practice datasets fall into three groups: small sample databases for learning joins, real public data for messy practice, and cloud sample data you query without loading anything. This page lists the free ones, with what each contains, where to get it, its license and which database engines it runs on. If you want a structured path first, see the learn SQL hub.
The short version
- Sakila (MySQL) and Pagila (PostgreSQL) model a DVD rental shop. Pagila’s README says 1,000 rows in
film. - Chinook runs on DB2, MySQL, Oracle, PostgreSQL, SQL Server and SQLite, and carries an MIT license.
- AdventureWorks comes in OLTP, Data Warehouse and Lightweight versions, as
.bakfiles from 2008 R2 to 2025. - The Stack Exchange data dump is 92.3 GB on the Internet Archive and licensed CC BY-SA 4.0.
- BigQuery’s free tier is 1 TiB of queries a month, and the sandbox caps storage at 10 GiB with 60-day table expiry.
- Snowflake’s
SNOWFLAKE_SAMPLE_DATAholds TPC-H at four scale factors (SF1, SF10, SF100, SF1000) and TPC-DS, with no storage charge. - NYC TLC trip files are Parquet, published monthly with about a two-month delay.
Which sample database should you start with?
Match the database to the engine you plan to use, then match the size to the skill you want to build.
| You want to practice | Start with | Engine |
|---|---|---|
| Joins, group by, subqueries | Sakila, Pagila or Chinook | MySQL, PostgreSQL, or any of six |
| Business reports, many tables | AdventureWorks | SQL Server, Azure SQL |
| Window functions on dates and amounts | Chinook invoices, or NYC taxi trips | Any, DuckDB |
| Large tables and slow queries | NYC TLC Parquet, Stack Overflow dump | DuckDB, PostgreSQL |
| Cloud warehouse cost and speed | BigQuery public data, Snowflake sample data | BigQuery, Snowflake |
If you are about to practice window functions, our SQL window functions cheat sheet runs on a small table you can recreate in minutes. To pick a client for these databases, read the best SQL editor roundup.
Which classic sample databases are free to download?
Sakila, Pagila, Chinook, Northwind and AdventureWorks are small, well documented and free. Each models a business, so the joins feel real.
Sakila (MySQL)
Sakila is MySQL’s own sample database, written by Mike Hillyer. The docs describe it as a standard schema for books, tutorials and examples, and it shows off views, stored procedures and triggers. License: the docs state that sakila-schema.sql and sakila-data.sql are under the New BSD license. The docs themselves are not under an open license. Get it from the MySQL docs. Runs on MySQL.
Pagila (PostgreSQL)
Pagila is the PostgreSQL port of Sakila: actors, films, categories, customers, rentals, payments, inventory and stores. Its README adds a partitioned payment table, a film_embedding table that needs pgvector, and JSONB data. A row count on film should return 1,000. License: the PostgreSQL license. The README says manual installs need PostgreSQL 18 or later plus pgvector, and offers a Docker Compose route. Get it from GitHub. Runs on PostgreSQL.
Chinook (six engines)
Chinook models a digital media store: artists, albums, tracks, invoices and customers. The media data comes from a real iTunes library, while customers and employees are made up and sales are randomly generated over four years. Scripts exist for DB2, MySQL, Oracle, PostgreSQL, SQL Server and SQLite. License: the repository’s LICENSE.md is the MIT License (copyright Luis Rocha). Get it from GitHub.
Northwind (SQL Server)
Microsoft’s samples repository carries the Northwind scripts (instnwnd.sql), originally written for SQL Server 2000, plus a separate script for Azure SQL Database. The folder’s page names no license, so check the repository before redistributing it. Many community ports exist for PostgreSQL and others, but we only list Microsoft’s version here. Get it from the Microsoft samples repo. Runs on SQL Server and Azure SQL.
AdventureWorks (SQL Server)
AdventureWorks is a bicycle manufacturer with sales, purchasing, production and HR tables. Microsoft Learn lists three versions: OLTP for most transaction workloads, Data Warehouse for analytics, and Lightweight, a pared-down OLTP. Backups run from 2008 R2 to 2025, and there are script zips if you do not want to restore a .bak. Azure SQL Database can create the Lightweight sample when you provision a database. Get it from Microsoft Learn. Runs on SQL Server, Azure SQL Database and Managed Instance, and Fabric SQL database. The page names no license, so read the repository’s terms first.
Sources: the project pages linked above, checked Nov 17, 2026. Row counts and file sizes appear only where the source states them.
Where can you find large, messy public data?
Two real datasets cover most needs: NYC taxi trips for sheer volume and the Stack Exchange dump for text-heavy tables.
NYC TLC trip records
The Taxi and Limousine Commission publishes yellow taxi, green taxi, for-hire vehicle and high-volume for-hire vehicle trips as Parquet files. Per its page, yellow data starts in 2009, green in August 2013, FHV in January 2015 and high-volume FHV in January 2019. Files appear monthly, usually with a two-month delay. The page states no data license and carries accuracy disclaimers, so treat it as practice data, not a source of record. Get it from the TLC page. Runs on anything that reads Parquet, including DuckDB.
Stack Overflow and Stack Exchange data dump
The Internet Archive item holds one 7-zip archive of XML per site, with Posts, Users, Votes, Comments, Badges, Tags, PostHistory and PostLinks. The whole item is 92.3 GB and the release we opened is dated 2024-04-02. License: CC BY-SA 4.0, which requires attribution. Get it from the Internet Archive. You must convert the XML before loading it into PostgreSQL or SQL Server. The Stack Exchange Data Explorer at data.stackexchange.com is a browser alternative. We could not load that site while researching, so check its page for refresh timing and limits.
Kaggle datasets
Kaggle hosts user-uploaded datasets, and each dataset sets its own license, per its documentation. You need a Kaggle account to download them. Read the license on every dataset page before you reuse the data.
Can you query cloud sample data without loading anything?
Yes. BigQuery and Snowflake both host sample data you query in place.
BigQuery public datasets and the sandbox
Google pays to store public datasets, and you pay only for queries. The first 1 TB per month is free, so you can query them without enabling billing (BigQuery docs). Use fully qualified names such as bigquery-public-data.bbc_news.fulltext. The samples dataset includes NOAA weather (gsod), US births (natality), shakespeare and wikipedia revision history to April 2010. The sandbox needs no credit card. It gives a lifetime 10 GiB storage quota that is not refunded when you delete data, the same 1 TiB monthly query allowance, and a 60-day expiry on tables, views and partitions. Streaming, DML and the Data Transfer Service are not available (sandbox docs).
Free query math
The allowance counts processed query data. A query that processes 50 GiB uses 50 / 1,024 = 4.9% of the monthly 1 TiB, so about 20 such queries fit in a month. This is our arithmetic on the published allowance, not a measured bill.
Snowflake sample data
Every account can use the shared SNOWFLAKE_SAMPLE_DATA database. It holds TPC-H and TPC-DS, one schema per data set, and it uses no storage in your account. TPC-H comes at four scales, TPCH_SF1, TPCH_SF10, TPCH_SF100 and TPCH_SF1000, each 10 times larger than the last, with eight tables: LINEITEM, ORDERS, CUSTOMER, PART, PARTSUPP, SUPPLIER, NATION and REGION. Snowflake’s docs are clear on the cost: running a query needs a warehouse, which consumes credits (Snowflake docs).
How do you practice locally with DuckDB and Parquet?
Install DuckDB, point it at Parquet or CSV files, and query them with no server. DuckDB’s httpfs extension also reads files over HTTP(S) and from S3, per its docs.
DuckDB ships a TPC-H extension that generates data on demand. Its docs give CALL dbgen(sf = 1); for scale factor 1, and setting sf = 0 builds the schema with no rows. That produces the same eight-table schema as Snowflake’s sample data, so queries port between them. For taxi data, download a monthly Parquet file and query it directly:
SELECT passenger_count, COUNT(*) AS trips
FROM read_parquet('yellow_tripdata_YYYY-MM.parquet')
GROUP BY passenger_count
ORDER BY trips DESC;
Which dataset suits which database?
Use this table to pick by engine. All entries come from the sections above.
| Dataset | Contains | Engines | License or terms | Where |
|---|---|---|---|---|
| Sakila | DVD rental | MySQL | New BSD (schema and data files) | MySQL docs |
| Pagila | DVD rental, 1,000 films | PostgreSQL 18+ for manual install | PostgreSQL license | GitHub |
| Chinook | Media store | DB2, MySQL, Oracle, PostgreSQL, SQL Server, SQLite | MIT | GitHub |
| Northwind | Trading company | SQL Server, Azure SQL | Not stated on folder page | Microsoft |
| AdventureWorks | Bicycle maker, OLTP, DW, LT | SQL Server, Azure SQL | Not stated on Learn page | Microsoft Learn |
| Stack Exchange dump | Posts, users, votes | Load into any; XML source | CC BY-SA 4.0 | Internet Archive |
| NYC TLC trips | Taxi and ride-hail trips | Anything reading Parquet | None stated, accuracy disclaimers | TLC |
| BigQuery public data | Many topics | BigQuery | Varies by dataset | Google Cloud |
| Snowflake sample data | TPC-H, TPC-DS | Snowflake | Benchmark data; read Snowflake’s terms | Snowflake docs |
| DuckDB TPC-H | Generated TPC-H | DuckDB | Generated locally | DuckDB docs |
Sources: the project and vendor pages linked in this article, checked Nov 17, 2026. “Not stated” means the page we opened does not name a license.
What should you do after loading a dataset?
Write questions first, then queries. “Which five customers spent the most in 2026?” and “What share of revenue came from each month?” teach more than reading a schema. If a question needs a subquery that references the outer query, see the correlated subquery guide. To see how queries reach the planner, read the SQL order of execution.
Questions people ask
What is the best free database to practice SQL on?
For joins and group by, a small star-shaped database such as Sakila (MySQL), Pagila (PostgreSQL) or Chinook (six engines) is enough. Pagila ships 1,000 films according to its README. Pick the one that matches the engine you will use at work.
Where can I get large datasets to practice SQL?
NYC TLC publishes taxi and ride-hail trip records as Parquet files every month, going back to 2009 for yellow taxis. The Stack Exchange data dump on the Internet Archive is 92.3 GB in total. DuckDB can query Parquet files directly.
Is BigQuery free for practice?
Yes, within limits. Google gives 1 TiB of query processing per month free, and the sandbox needs no credit card. Sandbox storage is capped at 10 GiB for life, tables expire after 60 days by default, and DML statements are not supported.
Does Snowflake have sample data?
Yes. The SNOWFLAKE_SAMPLE_DATA database holds TPC-H and TPC-DS data and uses no storage in your account. Queries still need a running warehouse, which consumes credits, so you need a Snowflake account to use it.
Can I use these datasets commercially?
It depends on the license. Sakila data files are New BSD and Pagila uses the PostgreSQL license. Stack Exchange data is CC BY-SA 4.0 with attribution. NYC TLC states no license on its page. Read each source before you redistribute anything.
Which database should I load practice data into?
DuckDB is the lowest-effort local choice because it runs without a server and reads Parquet and CSV files directly. Use PostgreSQL if your job uses it, and SQL Server for AdventureWorks. Our SQL editors guide covers clients for each.
Sources
- Chinook database (GitHub) ·
- Pagila (GitHub) ·
- Sakila sample database license (MySQL docs) ·
- Northwind and pubs sample databases (Microsoft SQL Server samples) ·
- AdventureWorks sample databases (Microsoft Learn) ·
- Stack Exchange data dump (Internet Archive) ·
- NYC TLC trip record data ·
- BigQuery sandbox (Google Cloud docs) ·
- BigQuery public datasets (Google Cloud docs) ·
- Snowflake sample data (Snowflake docs) ·
- Snowflake TPC-H sample data ·
- DuckDB TPC-H extension ·
- Kaggle datasets documentation ·