Module 01 Summary
The idea this module was built around
Before a query can be right, you have to know what one row means. That sentence - "one row is..." - is the grain, and almost every wrong number in analytics comes from someone who never said it out loud.
What you can now do
- Read a schema and state the grain of each table in one sentence
- Find the key that joins two tables, and predict what the join does to the row count
- Notice when a join has changed the grain, before it changes your totals
The trap this module removed
orders and order_items look like they describe the same thing. They do not. One holds 1,000 rows at one row per order; the other holds 3,400 at one row per product line. Joining them does not "add columns" - it multiplies rows, by an average factor of 3.4. Every fan-out error later in the course starts here.
Figures worth remembering
4,812 customers - 1,000 orders - 3,400 line items - 1,185 payments. There are more payments than orders because some orders are paid in instalments - a second, independent way for a join to change your grain.
Before you move on
Open any table you work with professionally and write its grain sentence. If you cannot write it without guessing, you have found something worth asking a colleague about - and you have found it before it cost you a number.
