My Demo Databases

An SQL text by Erland Sommarskog, SQL Server MVP. Most recent update 2026-11-03.
Copyright applies to this text. See here for font conventions used in this article.

Quick Summary

For several of my articles and sessions, I use Microsoft's old demo database Northwind or a variation of it with an alternate name. For most of these, you install the database by running the script for the database. But for the big one, Northgale, you need to first run Northwind.sql to build Northwind and then Northgale.sql to build Northgale, as Northgale takes its data from Northwind and inflates it.

Below, you find more details about what's inside of these databases, their sizes, requirements, and how the scripts work on different platforms, in case you run into problems. I definitely recommend you to read those details if you want to have any of the databases in Azure.

If you are running into issues not addressed on this page, don't shy to drop me a line on esquel@sommarskog.se – it may be an error on my part.

Northwind

Northwind is a very old demo database from Microsoft. I like it because it has tables with names that are immediately understood: Orders, Order Details, Customers, Products, Suppliers, Employees, Shippers. This permits me to write queries without having to explain the data model. There are a few odd things:. CustomerID columns are nchar(5), and the range for the order dates is from July 1996 to May 1998. The indexing is a little funny, too. Nevertheless, it works for articles and sessions where I only want to show query techniques. The database is small, less than 10 MB for the data file.

Microsoft has made the database available on Github. However, I recommend that you use the script Northwind.sql. I have made a few adjustments to Microsoft's script:

Apart from the above-mentioned data-type change I have preferred to stay faithful to the original schema and data.

When running Northwind.sql, the following applies in different environments:

SQL Server on-prem

The script drops any database named Northwind and creates a new database with that name. The database is set in SIMPLE recovery. At the end of the script, it shrinks the log file. The script runs on SQL Server 2005 and up. The database is created in your default Data and Log folders and with your server collation. (This is different from Microsoft's script, which always puts the database in the same folder as master.)

Azure SQL Managed Instance

If there is no database name Northwind, the script creates a database with that name. On re-run, it will not drop the database. Instead, it drops all known Northwind objects and re-creates them. Thus, if you have added your own tables, they are retained. The database remains in FULL recovery, as nothing else is permitted in Azure. The script does not shrink the log.

Azure SQL Database

You must create an empty database beforehand. Run Northwind.sql in that empty database. Just like on Azure SQL Managed instance, it will drop all known Northwind objects and recreate them. You will see one error message:

Msg 40508, Level 16, State 1, Line 26

USE statement is not supported to switch between databases. Use a new connection to connect to a different database.

Please ignore this message. (If you opt to call the database something else than Northwind, you will see this message twice.)

Variations on Northwind

I have some variations of Northwind where I've made adaptations to fit my needs. You load them in the same way as described for Northwind above.

NorthDynamic – Used in the article The Curse and Blessings of Dynamic SQL. There is one extra table Countries, and there are some small changes to the data.

NorthNumbers – Used in the articles The Power of Generate_series and Using a Table of Numbers. It features some extra tables and some modifications to the data. This database is bigger than Northwind in size, due to the extra tables.

Northwind_utf8 – This is a version of Northwind where all nvarchar/nchar columns are varchar/char and the collation should be a UTF‑8 collation. The script hard-codes the collation to my favourite, Finnish_Swedish_100_CS_AS_SC_UTF8. You may want to change that. :-) If you create this database on Azure SQL Database, you need to remember to pick a UTF8 collation when you create the database.

Northgale

Northgale is an inflated version of Northwind, and to build Northgale, you first need to build Northwind since the main bulk of the data in Northgale is the data in Northwind recombined with itself. For instance, two customers in Northwind are Alfreds Futterkiste and Berglunds Snabbköp. In Northgale you also find Berglunds Futterkiste and Alfreds Snabbköp and quite a few more Alfreds, Berglunds, Futterkiste and so on. In some places, I have added my own data to fit my needs or to fill in where Northwind was simply too thin. To note is that the data in the City column Customers table includes a few Ukrainian and Bulgarian place names in Cyrillic script.

The database is 1.5 GB in size, and there are a little more than one million orders. The range for the orders are from July 1996 to January 2002. There are around 6000 customers and products, around 750 employees and 2048 shippers.

The schema in Northgale does not follow the schema in Northwind slavically, but I've made modifications and additions to fit my needs. For instance, there is a TotalAmount column in the Orders table, and there is a discount system.

I might make changes over the years to accommodate new articles or presentations, so if you have a copy of Northgale from a few years back, you may want to get a fresh copy. Note that the script uses randomness in some places, so two different builds of Northgale may have smaller differences in the data.

To build Northgale, first run Northwind.sql and then run Northgale.sql. Here are more details for different platforms:

SQL Server on-prem

The script Northgale.sql drops any existing Northgale database and recreates it. The database is created on the default location and with the server collation. The script creates a secondary log file 4 GB in size and drops it at the end. The database is set to SIMPLE recovery. The script requires SQL 2008 or later. The script will attempt to exit if you have an older version or if Northwind is not present.

Azure Managed Instance

If there is no database name Northgale, the script creates a database with that name. On re-run, it will not drop the database, but it will drop all known Northgale objects and re-create them. Thus, if you have added your own tables, they are retained. The database remains in FULL recovery, as nothing else is permitted in Azure. No secondary log file is created and the script does not shrink the log.

Azure SQL Database

Since you cannot move between databases on Azure SQL Database, it works a little differently here. First create the database by any name you like. Then run both Northwind.sql and Northgale.sql in that database. The Northgale script will check if there is a Northwind schema in the database, and if there is no such schema, the script creates the Northwind schema and moves all Northwind tables to that schema. The Northgale.sql script then proceeds to create the Northgale version of Orders, Customers and the other tables in the dbo schema. If you rerun the Northgale script, it will see the Northwind schema and drop all Northgale objects in the dbo schema, but not touch anything in the Northwind schema. Beware that with both scripts you will see one or two instances of error 40508 about the USE statement (see above). Just ignore this error message.

Note: The Northwind schema is created on all platforms. On on-prem and Managed Instance, you will find synonyms that point to the Northwind database.

Northgale_utf8

Just like Northwind_utf8, this is a version of Northgale where all string columns are varchar/char and where the collation in the script is hard-coded to Finnish_Swedish_100_CS_AS_SC_UTF8. Feel free to change. To build it, first run Northwind_utf8.sql and then Northgale_utf8.sql. The same platform considerations as above apply, except that the lowest supported version is SQL 2019.

If you are on Azure SQL Database, don't forget to select the correct collation when you create the database. The schema for the Northwind_utf8 objects is still called Northwind in Northgale_utf8.

Currently, I don't use Northgale_utf8 for any article or session, and I cannot promise that I will keep it up to date with regards to the nvarchar Northgale.

Revision History

2026-11-03
First version.

Back to my home page.