Following is a very simple Data Model to illustrate a Sales Fact Star Schema.
Sales_Fact is the fact table with four dimensions, date_dim, product_dim, store_dim and region_dim connected to it.
Here are the scripts in MySQL for creating the tables used in the model.
Date Dimension: Click following link to get the code to create the date dimension.
Product Dimension: Table Products_D
This is a very simple product dimension. Add more columns if necessary. Sample column may include: product_category, product_type, title, detailed_desc etc.
CREATE TABLE Products_D (
product_id INT PRIMARY KEY,
Store Dimension: Table Stores_D
This is also very simple. More columns like store_city, store_state, address columns, store_division can be added.
CREATE TABLE Stores_D (
store_id INT PRIMARY KEY,
Region Dimension: Table Regions_D
CREATE TABLE Regions_D (
region_id INT PRIMARY KEY,
Sales Fact: Table Sales_Fact
CREATE TABLE Sales_Fact (