You are on page 1of 2

STAR SCHEMA DESIGN

Star schema is the most simple kind of schema where one fact table is present in the centre of the
schema surrounded by multiple dimension tables.
In a star schema all the dimension tables are connected only with the fact table and no di mension
table is connected with any other dimension table.

Benefit of Star Schema Design
Star schema is probably most popular schema in dimensional modeling because of its simplicity and
flexibility. In a Star schema design, any information can be obtained just by traversing a single join,
which means this type of schema will be ideal for information retrieval (faster quer y processing). Here,
note that all the hierarchies (or levels) of the members of a dimension are stored in the single
dimension table - that means, lets say if you wish to group (veggie burger and chicken burger) in
"burger" categor y and (french fries and twister fries) in "fries" categor y, you have to store that
categor y information in the same dimension table.
SNOW-FLAKE SCHEMA DESIGN
Snow flake schema is just like star schema but the difference is, here one or more dimension tables
are connected with other dimension table as well as with the central fact table. See the example of
snowflake schema below.
Here we are storing the information in 2 dimension tables instead of one. We are storing the food
type in one dimension ("type" table as shown below) and food in other dimension.
SQL Query For Star Schema
Select distinct f.name, f.type
From food f, sales_fact t
where f.key = t.food_key
and t.store_key = 1

SQL Query For SnowFlake Schema
Select distinct f.name, tp.type_name
From food f, type tp, sales_fact t
where f.key = t.food_key
and f.type_key = tp.key
and t.store_key = 1

You might also like