Professional Documents
Culture Documents
(To Be Completed by Students) : B.1 Software Code Written by Student: Dealer - DW
(To Be Completed by Students) : B.1 Software Code Written by Student: Dealer - DW
Date_dw:
CREATE TABLE date_dw (
date_ID NUMBER PRIMARY KEY,
deal_year NUMBER NOT NULL,
deal_month NUMBER NOT NULL,
quarter NUMBER NOT NULL,
deal_date int
);
Branch_dw:
CREATE TABLE branch_dw (
branch_ID NUMBER PRIMARY KEY,
branch_name varchar(255) NOT NULL,
branch_addr varchar(255) NOT NULL,
country varchar(255)
);
SALE_FACT:
CREATE TABLE SALE_FACT(
dealer_id NUMBER REFERENCES dealer_dw(dealer_id),
product_id NUMBER REFERENCES product(product_id),
branch_id NUMBER REFERENCES branch_dw(branch_id),
date_id NUMBER REFERENCES date_dw(date_id),
units_sold int,
revenue int
);
Dealer_dwTable :
Date_dw Table :
Branch_dw Table:
Product Table :
SALE_FACT Table:
B.3 Observations and learning:
We learn how to create dimention tables using SQL.
B.4 Conclusion:
In this experiment we learn to create star schema model in SQL sheet.
Q1: What are the differences between Dimension table and fact table?
Primary key:
Colum that contains value that uniquely identify the each row of the table is called
primary key.
Surrogate key:
A Surrogate Key in SQL Server is a unique identifier for each row in the table. It is
just a key. Using this key we can identify a unique row. There is no business meaning for
Surrogate Keys.
Foreign key:
A Foreign key is a field (or collection of fields) in one table, that refers to the Primary
key in another table.