- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Data
Build a Fact Table in SQL Server
In this Azure SQL Database lab, you will declare a sales fact table's grain, classify its measures as additive or non-additive, build the fact with foreign keys to each dimension, a degenerate dimension, audit columns, and a constraint that protects the grain, load it by resolving each source business key to its dimension surrogate key, and validate the design with aggregation and drill-down queries to support reliable analytical reporting on a star schema.
Lab Info
Table of Contents
-
Challenge
Establish the fact grain and measures
- Review the source sales data and confirm that the dimensions the fact will reference are populated.
- Declare the fact grain explicitly as one row per sales order line.
- Classify each measure as additive or non-additive based on how it aggregates across the dimensions.
-
Challenge
Build the fact table structure
- Create the fact table with a surrogate key, foreign keys to each dimension, a degenerate dimension, measures, and an audit column.
- Add foreign key constraints to protect referential integrity and a unique constraint that enforces the declared grain.
- Confirm the table matches the intended schema before loading any data.
-
Challenge
Load and validate the fact table
- Load the fact by resolving each source business key to its dimension surrogate key, then confirm the grain holds.
- Run aggregation and drill-down queries that join the fact to its dimensions for slicing and rollups.
- Confirm the grain constraint rejects a duplicate order line, proving off-grain rows cannot be loaded.
About the author
Real skill practice before real-world application
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.