Home › Interview Questions › Design a star‑schema data model with a fact table …

Design a star‑schema data model with a fact table for orders and dimension tables for city, time, and status.

🟡 Medium Conceptual Junior level
1Times asked
Nov 2026Last seen
Nov 2026First seen

💡 Model Answer

To design a star‑schema for an order analytics system, start with a fact table that captures the measurable event: fact_orders(order_id PK, order_amount, order_date_id FK, city_id FK, status_id FK). The fact table should be denormalized and contain only numeric measures and foreign keys. Next, create dimension tables: dim_city(city_id PK, city_name, state, country); dim_time(time_id PK, date, month, quarter, year, day_of_week); and dim_status(status_id PK, status_code, status_description). Each dimension holds descriptive attributes that can be used for slicing and dicing. The primary keys of the dimensions are surrogate keys that link to the fact table. Indexes on the foreign keys improve join performance. Optionally, add a composite key on dim_time (year, month, day) to support range queries. The star‑schema allows efficient GROUP BY queries such as “total sales by city and month” because the fact table is joined to a small, denormalized dimension table. This design balances query performance with storage efficiency and is a common pattern in data warehousing.

This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.

🎤 Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers on a discreet on-screen overlay.

Get Assisting AI — Starts at ₹500