Is there a "Northwind" type database available for MySQL?
Finding a 'Northwind' Equivalent for MySQL: Sample Databases for Learning and Testing

Explore various options for a 'Northwind'-like sample database in MySQL, including official ports, community projects, and how to create your own for development and testing purposes.
The Northwind database is a classic sample database provided by Microsoft, widely used for learning SQL, database design, and application development. It represents a fictional company's sales data, including customers, orders, products, employees, and suppliers. While Northwind is inherently tied to Microsoft SQL Server and Access, developers often seek a similar, readily available sample database for MySQL environments. This article explores the best options for getting a 'Northwind' type database up and running in MySQL.
Why a Sample Database is Essential
Sample databases like Northwind are invaluable tools for developers, students, and data analysts. They provide a realistic yet manageable dataset to practice SQL queries, test application features, develop reports, and demonstrate concepts without the risk of corrupting production data. For MySQL users, having a familiar schema with diverse data types and relationships accelerates the learning curve and streamlines development workflows.
Official and Community Northwind Ports for MySQL
While there isn't an 'official' Northwind database from Oracle (MySQL's parent company), the community has created several excellent ports. These ports typically replicate the original Northwind schema and data, making them highly compatible for those familiar with the original. The most common approach involves SQL scripts that create tables and populate them with data.
erDiagram CUSTOMER ||--o{ ORDER : places EMPLOYEE ||--o{ ORDER : handles ORDER ||--o{ ORDER_DETAIL : contains PRODUCT ||--o{ ORDER_DETAIL : includes SUPPLIER ||--o{ PRODUCT : supplies CATEGORY ||--o{ PRODUCT : belongs_to CUSTOMER { int CustomerID PK varchar CompanyName varchar ContactName varchar ContactTitle varchar Address varchar City varchar Region varchar PostalCode varchar Country varchar Phone varchar Fax } ORDER { int OrderID PK int CustomerID FK int EmployeeID FK date OrderDate date RequiredDate date ShippedDate int ShipVia decimal Freight varchar ShipName varchar ShipAddress varchar ShipCity varchar ShipRegion varchar ShipPostalCode varchar ShipCountry } EMPLOYEE { int EmployeeID PK varchar LastName varchar FirstName varchar Title varchar TitleOfCourtesy date BirthDate date HireDate varchar Address varchar City varchar Region varchar PostalCode varchar Country varchar HomePhone varchar Extension text Notes int ReportsTo FK } PRODUCT { int ProductID PK varchar ProductName int SupplierID FK int CategoryID FK varchar QuantityPerUnit decimal UnitPrice int UnitsInStock int UnitsOnOrder int ReorderLevel boolean Discontinued } ORDER_DETAIL { int OrderID PK,FK int ProductID PK,FK decimal UnitPrice int Quantity float Discount } SUPPLIER { int SupplierID PK varchar CompanyName varchar ContactName varchar ContactTitle varchar Address varchar City varchar Region varchar PostalCode varchar Country varchar Phone varchar Fax text HomePage } CATEGORY { int CategoryID PK varchar CategoryName text Description blob Picture }
Simplified Entity-Relationship Diagram of the Northwind Database Schema
One popular and well-maintained port is available on GitHub, often referred to as 'northwind-mysql'. This project provides a comprehensive set of SQL scripts to create the tables, define relationships, and insert all the sample data. It's usually the go-to choice for developers looking for a direct Northwind equivalent.
Installing a Northwind-like Database in MySQL
The installation process typically involves downloading the SQL scripts and executing them against your MySQL server. You'll need a MySQL client (like MySQL Workbench, the command-line client, or phpMyAdmin) to perform these steps. Ensure you have appropriate permissions to create databases and tables.
-- Create the database
CREATE DATABASE northwind;
-- Use the newly created database
USE northwind;
-- Source the schema and data scripts
-- Assuming 'northwind-schema.sql' creates tables
SOURCE /path/to/your/downloaded/northwind-schema.sql;
-- Assuming 'northwind-data.sql' populates data
SOURCE /path/to/your/downloaded/northwind-data.sql;
Example SQL commands to install the Northwind database
Alternative Sample Databases for MySQL
If a direct Northwind port isn't exactly what you need, or if you're looking for something different, MySQL offers other excellent sample databases:
- Sakila Database: This is an official MySQL sample database representing a DVD rental store. It's well-designed, includes stored procedures, views, and triggers, making it great for advanced SQL practice and ORM testing.
- World Database: Another official MySQL sample, this database contains geographical data about countries, cities, and languages. It's simpler than Sakila but useful for basic joins and data retrieval.
- Employees Database: A large, realistic dataset containing information about employees, departments, salaries, and titles. It's excellent for performance testing and working with larger datasets.
These alternatives provide similar benefits to Northwind, offering diverse schemas and data for various learning and testing scenarios.
1. Download the SQL Scripts
Visit a reputable GitHub repository (e.g., https://github.com/dalers/my-northwind
) and download the northwind.sql
or separate schema and data files.
2. Access MySQL Client
Open your preferred MySQL client (MySQL Workbench, command line, DBeaver, etc.) and connect to your MySQL server.
3. Execute the Scripts
Run the SQL commands to create the database and populate it with data. For the command line, navigate to the directory where you saved the .sql
file and use mysql -u your_user -p < northwind.sql
(after creating the database and using it, or if the script includes CREATE DATABASE
and USE
statements).
4. Verify Installation
Once the scripts complete, run a simple query like SELECT * FROM Customers LIMIT 5;
to ensure the tables and data are present.