Question of the day · Databricks
Databricks Certified Data Analyst Associate: today's question
Today · Data Modeling with Databricks SQL
A gold fact_order_lines table has one row per order line. A designer copied the order-level shipping_cost onto every line, so an order with four lines repeats its shipping cost four times. Dashboards that sum shipping_cost by month now overstate it. What is the best modeling fix?
- AUse
SUM(DISTINCT shipping_cost)in every dashboard query - BMove
shipping_costinto the customer dimension table - CSnowflake the fact table into line and product sub-tables
- DStore shipping cost at order grain in its own fact table
Show the answer
D. Every fact table needs one declared grain. Shipping cost is measured once per order, so storing it on order-line rows mixes two grains and double counts whenever lines are summed. Keep it in an order-level fact table (or allocate it across lines so the parts add up). SUM(DISTINCT ...) is a fragile patch: two orders with the same shipping cost collapse into one value.
Written for practice in the style of the exam: never a question from the real exam. A new one every day.
Want ten more now?
The free readiness check asks ten questions weighted like the real exam and shows your score by section.