Pro ยท Practice data

Practice datasets

Load the sample scripts in SSMS, then practice filters, joins, and aggregates on tables this course actually ships.

Sign in to save your place.

Picture it this way

Each file in this lesson is a box of practice parts. A SQL script builds the tables and puts the parts in. You open the box in SQL Server Management Studio, run it, and then write your own questions against those tables. The CSV is the same kind of parts, packed for the import wizard.

Get a database, then run one script

In SSMS, create a database named SampleDB if you do not already have a practice database. Open SampleDB_CreateAndLoad.sql, glance at the USE lines, and execute it. The script drops and recreates Products, Customers, and Orders. It is safe to run again. It is not safe to run in a database whose tables of those names you need to keep.

FileTablesPractice
SampleDB_CreateAndLoad.sqlProducts, Customers, OrdersSELECT, joins, aggregates
Employees_Dept_Sample.sqlDepartments, EmployeesJoins, including a missing department
Sales_Data_Sample.sqlSalesSUM and GROUP BY on dates
Practice_Exercises_Module6.sqlUses SampleDBWrite the answers under each comment
customers_orders_sample.csvOne flat fileImport wizard

Lisa Davis in the employee script has a null department. She is there so a left join still shows her. If your join drops her, you used an inner join.

Queries to try

After SampleDB loads, these three questions match the columns in the script. Write them yourself before you read them as a hint.

-- Products in Electronics, cheapest first.
SELECT ProductName, UnitPrice
FROM dbo.Products
WHERE Category = 'Electronics'
ORDER BY UnitPrice;

-- How many orders each customer has, including a customer with none
-- if you loaded only the sample customers who did order.
SELECT c.CustomerName, COUNT(o.OrderID) AS orders
FROM dbo.Customers AS c
LEFT JOIN dbo.Orders AS o ON o.CustomerID = c.CustomerID
GROUP BY c.CustomerName;

-- Revenue by category. Quantity times unit price.
SELECT p.Category, SUM(o.Quantity * p.UnitPrice) AS revenue
FROM dbo.Orders AS o
JOIN dbo.Products AS p ON p.ProductID = o.ProductID
GROUP BY p.Category;

The exercise file has seven prompts and no answers. Run SampleDB first, then fill the prompts in that file. A correct answer returns rows. An answer that errors is still progress if you can say which object name was wrong.

Import the CSV

The CSV repeats the customer on each order line. That is a flat extract, not the three tables. Right-click the database, choose Tasks, then Import Data, and land it in a new table such as dbo.OrdersFlat. Compare a count of distinct customer names in the flat table with dbo.Customers. They should agree for this sample. If they do not, the import guessed a type and dropped a row, or you imported the header as data.

These scripts are practice data

Do not run the DROP statements against a database that holds work you meant to keep. Create SampleDB and stay inside it.

Load, then ask

One script builds the practice tables; a quick count proves it worked.

  1. SampleDB_CreateAndLoad.sqlCreates Products, Customers, Orders
  2. SSMSRuns the script in SampleDB
  3. CheckCounts and a first join

Step 1 of 3The script drops and recreates three tables. It is safe to run again, but not in a database whose tables of those names you need.

USE SampleDB;
-- DROP / CREATE Products, Customers, Orders

Done when

SampleDB has products, customers, and orders. One join returns a customer and a product name on the same row. One aggregate returns a total. The exercise file has your own statements under at least the first three comments.

Knowledge check

Which script creates Products, Customers, and Orders?

Why does Lisa Davis have a null department?

Where should you run the DROP statements?

Official sources

Checked against vendor documentation in October 2026. Screens and plan names still change, so confirm the control in your own instance.