Sample Data for SQL Databases
Are you looking for some sample data sets to practice your SQL?
If so, you’re in the right place.
On This Page
This page contains:
- Several different data sets that you can download and use on your own database
- SQL script files to create the tables and load the data, with different sets of scripts for Oracle, SQL Server, MySQL, and Postgres
- An explanation of each data set with links to a more detailed explanation and an ERD
- Steps on how to download the files, how to load the data, and what to do if you have any issues
How to Download Scripts from GitHub
To download the scripts from GitHub for your own use, you can either download them individually from the website, or use Git commands.
Here are the steps to download them manually:
- Click on the SQL Scripts link for the data set above that you want to download.
- On the GitHub page that is displayed, open the folder for the database vendor you’re working with (e.g. MySQL).
- Click on the SQL file in the list to open it in GitHub
- Click on the Raw button on the top right to view the SQL file
- Right-click on the page and select Save As
- Save the SQL file to your computer
Repeat steps 3-6 above with all of the SQL files you need to download.
Coming soon: a guide on using Git commands to download the scripts (which I imagine will be easier than downloading them manually!)
How to Load the Data
All of the SQL scripts include the Create Table statements and Insert statements to add the data to the tables.
To load the sample data into your database, you will need:
- An IDE (MySQL Workbench, SSMS, SQL Developer, etc)
- A database (e.g. MySQL, SQL Server Express, Oracle Express, Postgres)
I’ll link to the How To Guides for setting these up when they are created.
Assuming you have an IDE and a database, you can load the data by:
- Open each of the scripts for the data set
- Run them in numerical order: run the script starting with 01 first, then the script starting with 02, and so on.
If there are any errors when running the scripts, you should be able to rerun only that file to drop and create the tables again.
Are you getting an error when running the script?
Is there a syntax error or some other error in the script?
If so, they can be easily updated. Because the scripts are on GitHub, there are a few ways.
- Create an Issue on the GitHub repository describing the issue and error, and the script name that is impacted. I can investigate and fix the file.
- Or, if you know the fix and want to fix it yourself, create and submit a Pull Request for the file.
- Or, you can fill out my Contact Form here which will send me an email.
Coming soon: a how-to guide on creating a Pull Request to request an update to these files.
Submit a PR on the file if you want to change it – full how to coming soon
Or use the contact form
Or raise an issue on GItHub repo