Tables, keys, and the grain of a dataset
The grain describes what one row represents. Primary and foreign keys identify records and relationships, while consistent grain prevents accidental double counting.
Worked example
orders(order_id, customer_id, ordered_at)
order_items(order_id, line_number, product_id, quantity)
Put it into practice
Define the grain and candidate keys of orders, order items, products, and customers.
Check your understanding
- Explain the main idea in your own words.
- Compare your result with the worked example and identify any assumptions you made.
- Record one question or edge case to discuss with your instructor.
Connect this to your project
Build a repeatable retail analytics pipeline with staging tables, a sales fact table, and documented quality checks.
Keep the output of this activity in your project folder. You will use it when you review and present your final work.
This is a free preview. Create an account to enroll and track your progress.