> ## Content Index
> Fetch the complete content index at: https://abundance.alloconomy.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Draw the first star
- URL: https://abundance.alloconomy.com/alloconomy/de-interview-draw-the-first-star/
- Published: 2026-11-22T05:10:08.000Z
- Updated: 2026-11-22T16:30:52.000Z
- Description: A publisher asks for shipped units by title, warehouse region, and fiscal week.
- Author: Sathya Narayanan
- Tags: Alloconomy, Data Engineering, Data Engineering Interview Field Guide, #web-only, #series-detail, #Import 2026-11-21 19:24, Grain and the star schema

1. [Collection · 10 seriesThe Data Engineering Interview Field Guide](https://abundance.alloconomy.com/alloconomy/data-engineering-interview-field-guide/)
2. [Series opening · 3 essaysGrain and the star schemaSeries 1 of 10](https://abundance.alloconomy.com/alloconomy/de-interview-what-earns-a-row/)
3. This essay2 of 3

Data engineering · 3 essays

Grain and the star schema

Complete reading path · You are in Part 2 of 3
1. Part 1[What earns a row](https://abundance.alloconomy.com/alloconomy/de-interview-what-earns-a-row/)A marketplace records a cart edit, an order acceptance, and a warehouse reservation for the same six books.
2. Part 2**Draw the first star**Current essayA publisher asks for shipped units by title, warehouse region, and fiscal week.
3. Part 3[One order line in two parcels](https://abundance.alloconomy.com/alloconomy/de-interview-one-order-line-in-two-parcels/)Your first query reports twelve ordered units for a six-unit line.

## The interview prompt

A publisher asks for shipped units by title, warehouse region, and fiscal week. Draw the smallest star that can answer her, including the keys. Then explain which two errors could cancel out and leave the grand total apparently correct.

## Trace four books through the joins

Give the dispatch fact this row: dispatch line D91, product version P7, origin W2, dispatch date K14, quantity 4\. The product dimension maps P7 to the field guide. W2 maps to North. K14 maps to fiscal week 8\. One fact should contribute four copies to exactly one North/week 8 group. An order number can remain a traceable identifier on the fact.

The operational table behind checkout may include author addresses, catalog relationships, and shipment updates at different scopes. Expose only the attributes needed to group this observation. If a publisher changes ownership, decide whether the report means the publisher at dispatch or the publisher today. That controls which product row the fact should use.

I would ask the candidate to sketch the following diagnostic before tuning the join. On this simplified model `dispatch_line_id` is unique. The left join keeps an unmatched fact visible. Counting the dimension key returns zero for a miss and two for duplicate matches.

```sql
SELECT d.dispatch_line_id, COUNT(p.product_key) AS product_matches
FROM dispatch_line AS d
LEFT JOIN product_dim AS p ON p.product_key = d.product_key
GROUP BY d.dispatch_line_id
HAVING COUNT(p.product_key) <> 1;

```

The expected result on clean data is an empty result set. Repeat the check for each dimension, then reconcile the quantity at the output grain.

## The model behind the answer

Put the dispatch in the center. Start the sketch with a dispatch-line ID, a product key, a dispatch-date key, and the quantity shipped. Add a warehouse key if each dispatch line has one origin. The central **fact table** holds observations and their measures. The surrounding **dimension tables** give a product its title, a date its fiscal week, and a warehouse its region. These joins form a star schema.

Try the query aloud. “I sum dispatched quantity by fiscal week and product title.” Each dispatch row must resolve to exactly one applicable product row and one date row. If two products match, the four books can become eight in the result. If none match and the query uses an inner join, all four can disappear.

Write down one control before adding more columns. Sum shipped quantity before and after enrichment, then check that every dispatch ID has exactly one output row. The total alone can hide a missing row and an equal-sized duplicate. [Kimball’s dimensional modeling techniques](https://www.kimballgroup.com/data-warehouse-business-intelligence-resources/kimball-techniques/dimensional-modeling-techniques/?ref=abundance.alloconomy.com)

## Review a join whose grand total passes

Ask an agent for a star-schema change and a reconciliation query. Give it clean sample data. As reviewer, supply a separate four-unit dispatch whose product is missing and another four-unit dispatch whose lookup returns two rows. Work out both match counts before running the change.

**Reviewer decision.** The grand total can still be eight after an inner join. Demand the per-dispatch counts of zero and two, name the affected keys, and have the author explain how unresolved facts appear in the report. Keep this pair in the regression suite after the join is repaired.

*Further reading.* [The Data Warehouse Toolkit](https://www.amazon.com/dp/1118530802?ref=abundance.alloconomy.com), 3rd ed., on dimension keys and descriptive context.

## One more question

Four copies disappear on one unmatched product and four extra appear on a duplicated product. Which control catches it?

Check your reasoning

The grand total agrees by coincidence. The per-dispatch match count isolates both facts. An explicit unknown-product member can preserve the four unmatched units and give the catalog team a repair queue. Monitor that member separately so silent mapping failures cannot accumulate.

1. [Back to the series openingGrain and the star schemaSeries 1 of 10](https://abundance.alloconomy.com/alloconomy/de-interview-what-earns-a-row/)
2. [Explore the collectionThe Data Engineering Interview Field Guide](https://abundance.alloconomy.com/alloconomy/data-engineering-interview-field-guide/)

[Previous · What earns a row](https://abundance.alloconomy.com/alloconomy/de-interview-what-earns-a-row/) · [Next · One order line in two parcels](https://abundance.alloconomy.com/alloconomy/de-interview-one-order-line-in-two-parcels/) · [Complete series map](https://abundance.alloconomy.com/alloconomy/data-engineering-interview-field-guide/)