A sample database makes a lesson concrete, but the wrong one can hide the behavior you meant to teach. Which sample database you choose depends on the tables, scale, and awkward data shapes the demonstration needs.

Let the Lesson Decide Which Sample Database to Use
Write one sentence describing the behavior the learner should see. A join lesson needs related tables and a few unmatched rows. A warehouse lesson needs facts and dimensions. A plan regression lesson needs enough data and skew for the optimizer to face a real choice. The familiar name of a sample database is less important than the specific rows and indexes in the lesson.
I test the demo query before writing slides. If it returns no rows, the sample is not doing its job. If it returns a perfect, even distribution, it can conceal the problem I want to show. Which result would convince a learner that the concept matters? Pick data that makes that result visible.
Use AdventureWorks for Relational Basics
AdventureWorks provides a business setting with products, sales, people, and related entities. It is useful for joins, grouping, constraints, views, and common query examples. Many SQL Server readers recognize its schema, which reduces the time spent explaining the fictional company. Choose a version compatible with the target SQL Server instance and record the exact backup used.
AdventureWorks is not automatically ideal for every performance lesson. A compact sample can produce scans that are faster than index seeks, simply because the table is small. I use it for clear relational examples and enlarge or reshape data when the point is cost-based plan choice. Do not claim a production performance lesson from a tiny table.
Use WideWorldImporters for Modern Features
WideWorldImporters represents an operational import and sales business. Its OLTP and data warehouse variants support examples involving orders, stock, analytics, and newer SQL Server features. The warehouse variant is useful when a lesson needs fact tables, dimensions, or columnstore concepts. Check the specific edition and features required by the variant you install.
I compare the table design with the lesson before selecting it. A demonstration of transactional order processing belongs in the OLTP database, while a warehouse aggregation belongs in the analytical one. Both can be extended with generated data for deeper performance exercises. Keep the initial baseline so a demo reset does not become a manual rebuild.

Use Stack Overflow Data for Skewed Questions
Public Stack Overflow data is useful for realistic-looking posts, comments, users, and tags. It naturally raises questions about popular users, long threads, missing relationships, and uneven activity. That shape can make indexing and cardinality discussions more interesting than uniform generated values. Confirm the source, license, privacy conditions, and schema of the particular data set before using it in a public demo.
I keep a small reproducible extract for teaching. A full public dump can be too large for a classroom machine and too slow to reset. A filtered extract can lose the skew that made the data useful. Inspect the distribution after reducing it. Which rows make the query hard? Keep those, along with enough surrounding data to preserve the plan choice.
Inspect Which Sample Database You Restored Before the Demo
Do not assume that a table has the same name or row volume across sample versions. The following queries let you inspect user tables and approximate partition row counts in the current database. Run them after connecting to the intended sample. They show structure and scale, not whether the lesson is pedagogically clear.
I also check keys, indexes, and collation. A query that works on one sample restore can fail on another with a changed schema. Save the sample version and a short setup check with the demo. A learner should be able to reproduce the example without guessing which sample database backup you used.
SELECT s.name AS schema_name, t.name AS table_name
FROM sys.tables AS t
JOIN sys.schemas AS s ON s.schema_id = t.schema_id
ORDER BY s.name, t.name;Check Volume Without Pretending It Is Enough
The next query shows approximate rows for heaps and clustered indexes. It is a first look at scale, not a guarantee that a performance problem will reproduce. A table with many rows but perfectly uniform values can still behave differently from a smaller skewed one. Check statistics, predicate selectivity, and relevant indexes for the actual demo query.
Which sample database should you use if none fits? Build a small custom fixture with explicit edge cases. The best teaching data produces a clear before and after without asking the audience to wait through a long load.
SELECT OBJECT_SCHEMA_NAME(object_id) AS schema_name,
OBJECT_NAME(object_id) AS table_name,
SUM(row_count) AS rows_present
FROM sys.dm_db_partition_stats
WHERE index_id IN (0,1)
GROUP BY object_id
ORDER BY rows_present DESC;Record Which Sample Database and Installation Path You Used
Keep the chosen sample’s install steps with the lesson. The existing install guide covers the current AdventureWorks and WideWorldImporters setup. Record the selected database name, backup version, instance requirements, and any data changes you make afterward. A public demo should not depend on a file whose origin nobody can find.
I rehearse the restore and reset from a clean machine or disposable instance before recording. If the sample needs an optional feature, say so early. A demo that works only on the author’s workstation is a poor sample for learners. The data is part of the lesson, and its installation is part of the deliverable.
The choice of sample database should match the teaching question. A transactional schema teaches joins, keys, and order workflows. A warehouse-style schema teaches dimensional modeling. A tiny purpose-built fixture is best for isolating one optimizer behavior. I avoid treating any sample database as a faithful model of every production workload. Its data distribution, indexes and row counts were chosen for demonstration, not for your application’s service objective.
Keep a versioned setup note with the database backup or installer version, restore steps and any modifications made for the demo. If an exercise adds an index or changes compatibility level, record that change so the next learner can reproduce the result. I start each demonstration by naming the expected state. Otherwise a script copied from a different sample version can fail for a reason unrelated to the lesson. The installation path is part of the teaching material, not a footnote.
Related reading on this blog: Install AdventureWorks and WideWorldImporters: Updated 2026 and Download and Install SQL Server Sample Databases (Updated Post for 2019).

A sample database is not a trophy collection, it is the fixture that makes one lesson visible.
Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.




