HTML CSS Bootstrap JavaScript jQuery MySQL PHP Data Mining

Star Schema


A Star Schema organizes data in a way that makes it easy for students and analysts to query and understand. Think of the schema as a star: the center is a fact table with the main numeric measurements, and the points are dimension tables that describe those facts.

In a typical sales database, the fact table might record every transaction (date, product, customer, quantity, amount). Surrounding it are dimensions that give context:

Star Schema diagram

Figure: Example star schema with one fact table and four dimension tables.

Key components explained

Fact Table: This is the core of the schema. It stores measurable, numerical data such as sales amount, units sold or profit. Each row is a single event or transaction and contains foreign keys linking to the dimensions.

Dimension Tables: These tables provide descriptive information to help make sense of the numbers. They are usually much smaller and are used to filter or group facts.

  • Product Dimension: Details about products (e.g., Product ID, Name, Category, Price). Useful for asking questions like "Which products sell best?".
  • Customer Dimension: Information on buyers (e.g., Customer ID, Name, City, Age Group). Enables analysis by customer demographic.
  • Time Dimension: Date-related attributes (e.g., Time ID, Day, Month, Year, Quarter). Essential for trend analysis over time.
  • Promotion Dimension: Information about marketing campaigns (e.g., Promotion ID, Name, Start Date). Helps evaluate impact of promotions on sales.

Because each dimension connects directly to the fact table (and not to each other), queries can be written simply and run quickly—ideal for beginners learning about data warehousing.