Uploaded by Niranjan Chaudhari

exp2 (1)

advertisement
Name : Niranjan Chaudhari
Class : CSE (IOT & CSBT)
(TE)
Roll No.:03
EXPERIMENT NO. 2
AIM:- Implementation of all dimension tables and fact table based on experiment 1
case study.
THEORY:
FACT_TABLE:
fact table is the central table in a star schema of a data warehouse. A fact table
stores quantitative information for analysis and is often denormalized.
A fact table works with dimension tables. A fact table holds the data to be analyzed,
and a dimension table stores data about the ways in which the data in the fact table
can be analyzed. Thus, the fact table consists of two types of columns. The foreign
keys column allows joins with dimension tables, and the measures columns contain
the data that is being analyzed.
Dimension_Table
A dimension is a structure that categorizes facts and measures in order to enable users
to answer business questions. Commonly used dimensions are people, products, place
and time.
In a data warehouse, dimensions provide structured labeling information to otherwise
unordered numeric measures. The dimension is a data set composed of individual,
non-overlapping data elements. The primary functions of dimensions are threefold: to
provide filtering, grouping and labelling.
Source Code :
• fact_table
create database ewallet;
use ewallet;
create table fact_table(transaction_id int,customer_id int,transaction_date
varchar(100),wallet_id int,type varchar(100),credit float,debit float);
insert into fact_table values(01,1001,'10-09-2023',9991,'credit',900,0);
insert into fact_table values(02,1002,'11-09-2023',9992,'ewallet',0,1001);
insert into fact_table values(04,1003,'12-09-2023',9993,'BHIM UPI',0,8500);
• Dimension_Table:
create table dim_table;
create table dim_table(customer_id int,first_name varchar(50),last_name
varchar(50),gender varchar(50),email varchar(50));
insert into dim_table
values(1001,'Niranjan','Chaudhary','Male','whyniranjan@hotmail.com');
insert into dim_table
values(1002,'Pravin','Chirivella','Male','whypravin@hotmail.com');
insert into dim_table
values(1003,'Uday','Rathi','Male','whyuday@hotmail.com');
Download