Home / Restore Database / SQL Server / How to Set Up the WideWorldImporters Sample Database in SQL Server (Step-by-Step Restore Guide)

How to Set Up the WideWorldImporters Sample Database in SQL Server (Step-by-Step Restore Guide)

On

If you’re learning SQL Server for the first time, one of the best ways to practice real-world queries is by working with a professionally built sample database. Microsoft provides several sample datasets, and among them, WideWorldImporters is the most modern, realistic, and feature-rich option.

WideWorldImporters includes transactional data, warehouse data, JSON usage, temporal tables, and sample business operations that look almost exactly like what you’ll see in a real company. For this reason, it’s often used in SQL Server courses, developer training programs, and interview preparation.

In this guide, I’ll walk you step-by-step through how to download, restore, and verify the WideWorldImporters database using both SQL Server Management Studio (SSMS) and T-SQL scripts.

By the end, you’ll have the full sample database ready to use, even if you’re a complete beginner.


Step-by-Step: How to Install and Restore the WideWorldImporters Sample Database


1. Download the WideWorldImporters Sample Database

Microsoft provides this sample database for free. It usually includes:

  • WideWorldImporters.bak — OLTP database (operational system)

  • WideWorldImportersDW.bak — Data warehouse version (analytics)

(You can use either, but most beginners start with the OLTP version.)

Download - https://github.com/Microsoft/sql-server-samples

After you’ve downloaded the .bak file, move it to a location you can easily find.
Most developers use:

C:\SQLServer\Backup\

If this folder doesn’t exist, you can create it—SQL Server doesn’t require a specific folder name, but it helps keep things clean.


2. Restore the Database in SQL Server Management Studio (SSMS)

This is the simplest method for beginners.

Step 2.1 — Open SSMS

Launch SQL Server Management Studio, then connect to your installed SQL Server instance.

Step 2.2 — Right-click "Databases" → Restore Database

In the Object Explorer:

Databases → Right-click → Restore Database

Step 2.3 — Select “Device” and Choose the .bak File

A new window appears.

  • Under Source, select Device.

  • Click […] Browse.

  • Click Add, then locate the downloaded .bak file.


Step 2.4 — Select the Database Name

SSMS will automatically detect:

  • Database: WideWorldImporters

  • Backup type: Full

Leave everything as default unless you want to rename the database.


Step 2.5 — Restore Options

Go to the Options tab.

Ensure these two settings are ON:

  • ✔️ Overwrite the existing database (WITH REPLACE) — only if you’re restoring again

  • ✔️ Close existing connections

Click OK, and SSMS begins restoring.

Step 2.6 — Restore Completion Message

Once done, you’ll see:

“The restore of database ‘WideWorldImporters’ completed successfully.”

You now have the full OLTP sample database installed.



3. Restore the Database Using T-SQL (Advanced and Faster)

Many developers prefer using T-SQL because it’s repeatable, automatable, and cleaner.

Before running the restore script, verify the file path:

C:\SQLServer\Backup\WideWorldImporters.bak

Then open a new query window and run:

RESTORE DATABASE WideWorldImporters FROM DISK = 'C:\SQLServer\Backup\WideWorldImporters.bak' WITH MOVE 'WWI_Primary' TO 'C:\SQLServer\Data\WideWorldImporters.mdf', MOVE 'WWI_UserData' TO 'C:\SQLServer\Data\WideWorldImporters_UserData.ndf', MOVE 'WWI_Log' TO 'C:\SQLServer\Data\WideWorldImporters_log.ldf', REPLACE, RECOVERY;

Why do we need MOVE?

Backup files remember where the original SQL Server stored the database files.
If your system uses a different folder, SQL Server needs updated paths.

Without MOVE, you may get errors like:

Directory lookup for the file failed with the operating system error 3.

Running the full T-SQL script restores the database instantly.


4. Verify That the Database Was Restored Successfully

After restoring, run this simple query:

SELECT name, create_date FROM sys.databases ORDER BY create_date DESC;

You should now see:

  • WideWorldImporters

  • Possibly WideWorldImportersDW

You can also browse the tables:

Object Explorer → Databases → WideWorldImporters → Tables

Expect many realistic tables such as:

  • Sales.Orders

  • Purchasing.PurchaseOrders

  • Warehouse.StockItems

  • Application.People

This variety gives you everything you need to practice SELECT queries, JOINs, functions, views, and stored procedures.


Common Issues and How to Fix Them

Even experienced developers run into errors when restoring sample databases.
Here are the most frequent ones beginners face.


1. “Operating system error 5 (Access is denied)”

This usually happens when SQL Server cannot access your backup directory.

Fix:

  • Move the .bak file to a directory SQL Server can read

  • Example folder that always works:

C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Backup

You can also adjust folder permissions:

  • Right-click → Properties → Security → Add

  • Add the SQL Server service account (like NT SERVICE\MSSQLSERVER)


2. File path mismatch (requires MOVE)

This error looks like:

Cannot use file because it already exists.

Fix:

Use MOVE statements in your T-SQL restore script to manually set the location of .mdf/.ldf files.


3. Wrong SQL Server version

WideWorldImporters requires SQL Server 2016 or later.

Fix:

Upgrade to SQL Server Developer Edition (free) version 2019 or 2022.


4. “There is not enough space on disk”

Sample databases vary from 100MB to 1GB depending on version.

Fix:

  • Free disk space

  • Restore to a different drive using MOVE

  • Shrink after restore (optional)


Tips From a SQL Developer (Practical Insights)

Here are the things I always tell beginner developers:


✔️ Tip 1 — Always restore to a consistent folder names

I use:

C:\SQLServer\Data\ C:\SQLServer\Backup\

Having clean folders makes your scripts reusable across projects.


✔️ Tip 2 — Keep both OLTP and Data Warehouse versions

WideWorldImporters comes with:

  • OLTP (used for transactional queries)

  • DW (used for analytics and SSIS/SSRS learning)

Having both lets you practice:

  • Reporting

  • Data transformation

  • Warehouse concepts

  • ETL pipelines


✔️ Tip 3 — Explore built-in examples

WideWorldImporters includes:

  • Temporal tables

  • JSON columns

  • Stored procedures

  • In-memory tables

  • Business examples (orders, invoices, stock items)

All of these help prepare you for your first SQL job or interview.


Summary / Key Takeaways

Here is a quick recap of what we covered:

  • WideWorldImporters is Microsoft’s modern SQL Server sample database

  • You can restore it using SSMS or a simple T-SQL script

  • Use MOVE options if paths don’t match

  • SQL Server may require permissions to access your backup directory

  • After restore, you can browse realistic tables and datasets for practice

  • Perfect for SQL beginners, analysts, and developers learning joins, procedures, temporal tables, and more

With this database installed, you’re ready to start practicing real-world SQL.


FAQ (Beginner-Friendly)

1. Do I need SQL Server Developer Edition to use WideWorldImporters?

Yes. Developer Edition is free, includes all SQL Server features, and supports restoring sample databases.


2. What’s the difference between WideWorldImporters and AdventureWorks?

  • AdventureWorks is older and simpler—good for basic SQL.

  • WideWorldImporters is newer and includes features like temporal tables and JSON.