Collection: SQL Server Sample Databases

Why create a whole database when you can use an existing one for testing purposes? Today, I've collected a list of sample databases for SQL Server.

Written by Jonathan "JD" Danylko • Last Updated: • Develop •

Black and Grey device

There are times when you need a sample database to test out a query or benchmark the database or server in general.

What better way than to use production...err..I mean, a test database?

It's been a while since I've done a collection post so I thought this would be perfect.

This collection of databases is meant to show how to properly design databases and how applications use them efficiently.

Microsoft also has some official sample databases here. Some of them I mentioned below.

Oh, and they're also great test databases to beat on for performance scenarios.

Northwind Database

Nothing like a old classic to kick off the list.

The Northwind Database works with SQL Server 2005 and 2008 and was originally created for demonstration purposes for Microsoft Access. It eventually transitioned over to SQL Server.

AdventureWorks

AdventureWorks Cycles is another classic database representing a fictional company created and published by Microsoft.

The database shows how to design a SQL Server database using SQL Server 2008 and AdventureWorksDW is the data warehouse sample.

It works with 2005, 2008, 2008R2, 2012 RTM, and Azure. 

Another version exists at Microsoft SQL Server Samples GitHub.

Contoso University

The Contoso University is an updated database to show how a schooling database would look like.

It's a simple database example. There is also a sample script of how to create it.

Since the script is simple enough, it should work on every SQL Server.

StackOverflow Database

I first found out about this through Brent Ozar's post on How to Download the StackOverflow database via BitTorrent.

The database is segmented into three downloads:

  • Large (41GB expands to 312GB)
  • Medium (10GB expands to 50GB)
  • Small (1GB expands to 10GB)

Each one has certain tables included like badges and post history. It's probably best to determine what data you find relevant and download the appropriate version.

FoodMart Database

While this isn't a common database, this database is the Mondrian Data Loader which pre-loads data for mySQL, Postgress, SQL Server, and Sybase databases.

World-Wide Importers

This Microsoft sample database is a more updated version to work with SQL Server (starting with 2016) and Azure. Examine the list to know whether you want the Azure or SQL Server version of the data. 

Chinook Database

Finally, we have the Chinook database which represents a digital media store, including tables for artists, albums, media tracks, invoices and customers.

This database supports not only SQL Server, but DB2, EffiProz, MySQL, Oracle, PostgreSQL, SQL Server Compact, and SQLite Data Model.

UPDATE: NYC Taxi

This SQL Server database was introduced to me through Matt Groves (@mgroves). It consists of a .BAK file and consists of public data from the New York City Taxi and Limousine Commission.

The post presents how to use this database with several R and Python tutorials for in-database analysis, but it doesn't hurt to use it for other sample data.

Conclusion

This was a collection I felt necessary to create because of all of the different flavors of databases you can use to test without damaging your own database.

Did I miss a database? Which one is your favorite? Post your comments below and let's discuss.

Other Collections

ASP.NET 8 Best Practices on Amazon

ASP.NET 8 Best Practices by Jonathan Danylko


Reviewed as a "comprehensive guide" and a "roadmap to excellence" with over 120 Best Practices for ASP.NET Core 8, Jonathan's first book by Packt Publishing explores proven techniques for every phase of the SDLC.

Learn industry-standard concepts to improve your coding, debugging, and deployment of ASP.NET Core websites.

Order now on Amazon.com button

Picture of Jonathan "JD" Danylko

Jonathan "JD" Danylko is an author, web architect, and entrepreneur who's been programming for over 30 years. He's developed websites for small, medium, and Fortune 500 companies since 1996.

He currently works at Insight Enterprises as an Architect.

When asked what he likes to do in his spare time, he replies, "I like to write and I like to code. I also like to write about code."

comments powered by Disqus