Data modeling
An analytics engineer interview on modeling warehouse tables with clear grain, sound joins, tested logic, and trusted metrics.
These prompts are original practice. They are not questions from a named employer or a live hiring loop.
1.A bike-share app is adding a staging model for its raw rides table. Which work belongs in that staging model?
2.At a county library, analysts query the raw loan tables directly. Every time the source system renames a column, several dashboards break. What do you do first?
3.What is the main job of an intermediate model in a layered transform project?
4.A payroll service has a mart named for its finance team. Which description best fits a mart model?
5.A developer at a grain co-op adds a join to the farmers table inside the staging model for deliveries. What is the concern?
6.A food bank's distribution mart selects straight from a raw source table and skips staging. What is the main risk?
7.A team builds staging models as views and marts as tables. Why is this a common choice?
8.Why declare raw tables as named sources in a transform project instead of hard-coding table names in each model?
9.What does it mean to state the grain of a fact table?
10.A ferry operator's ticket table has one row per ticket. A developer joins in passenger meal orders, which can be several per ticket. What happens to the grain?
11.A fitness studio table mixes daily attendance rows with monthly summary rows, marked by a row type column. What is the core risk?
12.You are designing an order fact for a bakery chain. Analysts need sales by product and also order totals. What grain do you pick?
13.A courier's daily shipment table should have one row per shipment per day. Which test best confirms that grain?
14.A water utility wants each meter's balance at the end of every day, even on days with no new readings. Which kind of fact table fits?
15.A loan servicer keeps one row per application, with a date column for each step: submitted, approved, funded, and closed. Rows are updated as steps finish. What is this?
16.A hotel group's mart has one row per booked night. An analyst averages the nightly rate column to report average booking value. What is wrong?
17.A new mart for a museum's memberships has no documented grain, and two analysts disagree on what a row means. What do you do first?
18.An online thrift shop stores cart items as an array on each cart event. You unnest the array in a model. What is the new grain?
19.In a star schema, what usually goes in a dimension table?
20.Which measure in a hardware store's daily sales fact is fully additive across every dimension, including time?
21.A credit union keeps a daily snapshot of account balances. Summing balances across all days in a month gives a huge number. Why?
22.Why do many teams prefer a star schema over a heavily snowflaked one for analytics marts?
23.A plumbing supply wholesaler keeps the invoice number on its sales fact table, with no separate invoice dimension. What is this called?
24.A freight broker's shipment fact has both a pickup date and a delivery date. How do you model them?
25.A home solar installer has sales and support marts. Each builds its own customer dimension, and cross-mart reports never match. What fixes this?
26.A school district wants to record which students attended which class sessions. There is no numeric measure. Which design fits?
27.Analysts at a pet insurance company want one wide table for a claims dashboard. A star schema for claims already exists. What is a reasonable response?
28.A help desk ticket fact has five low-cardinality yes or no flags that clutter it. What is a common design option?
29.A garden center's fiscal year starts in February, and analysts keep computing fiscal quarters wrong in their own queries. What fixes this?
30.What does a type 1 slowly changing dimension do when an attribute changes?
31.A seed supplier's customers sometimes move between sales regions. Finance wants past sales to stay credited to the region at the time of sale. What fits?
32.Which set of columns is typical in a type 2 dimension?
33.A scooter rental app has a type 2 vehicle dimension. A new model joins trips to it on vehicle id alone, and trip totals jump. Why?
34.A test on a payroll service's type 2 employee dimension finds two rows for one employee with overlapping valid from and valid to ranges. Why does this matter?
35.When is a type 1 change a sensible choice for an attribute?
36.How do many teams represent valid to on the current row of a type 2 dimension?
37.An orchard co-op's supplier system only stores current values and overwrites them on change. You now need supplier history. What do you do?
38.A climbing gym's member dimension tracks phone number as type 1 and membership tier as type 2. A member changes only their phone. What happens?
39.A pharmacy chain joins sales to a type 2 product dimension to get the price tier at the time of sale. Which join condition is right?
40.Why add a surrogate key to a dimension instead of relying only on the source system's id?
41.After a merger, a vet clinic network has two patient systems whose ids overlap, since both start at 1. How do you key the combined patient dimension?
42.A team builds surrogate keys as a hash of natural key columns instead of an auto-increment sequence. What is the main benefit?
43.A model builds a hashed key by concatenating three columns. Some keys come out null, and a few different rows share a key. What fixes both problems?
44.Which is the weakest choice of natural key for a customer dimension at a meal-kit service?
45.At a print shop, some order rows arrive with a null product key because the product record has not loaded yet. What is a common approach?
46.Why store the dimension's surrogate key on the fact, rather than the natural key, when the dimension is type 2?
47.A taco truck chain joins orders to payments, where some orders are split across several payments. Summing order amount after the join gives too much revenue. Why?
48.A plant nursery has the same fan-out from joining orders to payments. What is the best fix?
49.How can you detect fan-out from a new join while developing a model?
50.A theater has ticket sales and concession sales, each with many rows per show. Joining both to shows in one query and summing gives inflated totals. Why?
51.A developer fixes doubled revenue at a toy store by changing sum of revenue to sum of distinct revenue. Why is this risky?
52.At an urgent care group, a visit can have several diagnoses. Leaders want visit cost by diagnosis. What is an honest approach?
53.After a change to the store dimension, a coffee roaster's revenue mart is up 3 percent with no business reason. Which test should you check first?
54.What does an incremental model do on a normal scheduled run?
55.A podcast app's events can arrive up to three days late. The incremental model loads rows where event time is greater than the max event time already in the table. What happens?
56.For the same late-arriving events, what is the best fix?
57.A smart thermostat model reprocesses the last three days on each run but uses an append strategy. What is the result?
58.When should you run a full refresh of an incremental model?
59.A grocery delivery source sends the same order event several times with different ingest timestamps. How do you dedupe it?
60.A dedupe step uses row number over customer id ordered by updated at. Two rows for one customer share the same updated at. What is the issue?
61.A dental office chain's incremental model merges on patient id, but the new batch has two rows for some patients. What can happen?
62.A sporting goods store sells a new product before that product reaches the type 2 product dimension. What is a common approach?
63.An event ticketing marketplace marks deleted listings with an is deleted flag. Its incremental model only loads rows whose created at is newer than the last run. What goes wrong?
64.Why should each run of a transform be idempotent?
65.A video streaming service's incremental merge is slow because it scans the whole multi-year target table. What helps most?
66.At an office supply store, which test catches order lines that point at customer ids missing from the customers table?
67.A status column should only hold pending, shipped, or delivered. Upstream starts sending returned. Which test fails?
68.A ceramics marketplace's unique test on order line id starts failing after a teammate adds a join. What is your first move?
69.What does a source freshness check verify?
70.A farmers market app's dashboard shows zero sales for yesterday. No tests failed. The upstream load had quietly stopped. Which check would have caught this?
71.At a language learning app, one test fails every night on a few known bad historical rows, and the team now ignores all test failures. What do you do?
72.A team new to data testing has limited time. Where are tests most valuable to add first?
73.A tutoring marketplace needs to check that session revenue is never negative unless the row is a refund. Built-in generic tests do not cover this. What do you do?
74.A parking garage's daily row count fell 60 percent, but its freshness check passed. What is the most likely explanation?
75.When should data tests run in a transform project?
76.A regional bus agency's mart has a not null test on region, which comes from a left join to a stops dimension. The test fails. What is the likely cause?
77.What is the main benefit of a semantic layer for metrics?
78.A meditation app has two dashboards that show different numbers for active users. What is the first step?
79.A used car listing site reports monthly conversion rate. How should it be computed?
80.A county parks website gets weekly unique visitors by summing daily unique visitors. What is the problem?
81.Which belongs in a well-specified metric definition?
82.At a ski resort, finance and product disagree on whether revenue should include refunds and sales tax. What do you do?
83.A nonprofit fundraising team has its key business logic spread across 40 calculated fields in its business intelligence (BI) tool. What is the risk?
84.You plan to rename a column in a staging model. How does lineage help?
85.You are reviewing a pull request that changes a mart's SQL. What is most worth checking?
86.At a regional airline's loyalty program, someone fixed a bug by editing a production view directly in the warehouse. What happens on the next deploy?
87.Which documentation is most useful on a mart model?
88.Why do analytics engineers build models into their own development schema?
89.A pull request changes one staging model. What is the most efficient continuous integration (CI) build that still catches breakage?
90.A property management firm's finance tool reads a mart column you want to rename. What is the safest path?
91.A bookstore chain found a bug in its discount logic, so three years of history are wrong. What do you do before backfilling all of it?
92.A five-year backfill for a weather station network keeps timing out. What is a good approach?
93.After a backfill, an online course platform's revenue for last quarter changes by 4 percent. What do you do?
94.A recycling hauler backfills a staging model, which is built as a view. What else usually needs rebuilding?
95.During a long backfill, a public radio station's dashboards show a mix of old and new numbers. How can you avoid this next time?
96.A bike-share app runs in cities on both US coasts. How should its models store ride timestamps?
97.A pizza chain builds daily sales by truncating UTC timestamps to a date. Evening sales at its Chicago stores land on the next day. What is the fix?
98.A call center's report of orders by local hour shows a missing hour in March and a doubled hour in November. Why?
99.A travel booking source sends timestamps with no offset, and some rows come from European systems and some from US systems. What is the risk?
100.A car wash's coupons table returns 1000 for count star but 640 for count of coupon code. Why?
101.A recipe app computes the average of a rating column, where unrated recipes have a null rating. What is the result?
102.Two tables are joined on region code, and both have some rows where region code is null. What happens to those rows in an inner join?
103.A cooking class site left joins customers to orders, then adds a where filter that order status equals complete. Customers with no orders disappear. Why?
104.An email newsletter tool runs a query with id not in a subquery of blocked ids. It returns zero rows. The blocked list contains one null. Why?
105.A furniture store left joins customers to discounts and sums discount per customer. Customers with no discounts show null. The report needs zero. What do you do?
106.An air quality network sometimes misses a sensor reading. Should the staging model turn those nulls into zero?
107.A dog daycare groups sign-ups by referral source, and some rows have a null source. Where do those rows go?