Question: Create an OLAP Cube for the data warehouse given below: Create Table FactProductSales ( TransactionId bigint primary key identity, SalesInvoiceNumber int not null, SalesDateKey int,

Create an OLAP Cube for the data warehouse given below:

Create Table FactProductSales (

TransactionId bigint primary key identity, SalesInvoiceNumber int not null,

SalesDateKey int,

SalesTimeKey int,

SalesTimeAltKey int,

StoreID int not null,

CustomerID int not null,

ProductID int not null,

SalesPersonID int not null,

Quantity float,

SalesTotalCost money,

ProductActualCost money,

Deviation float

)

Add Relation between Fact table and dimension tables:

AlTER TABLE FactProductSales ADD CONSTRAINT _

FK_StoreID FOREIGN KEY (StoreID)REFERENCES

DimStores(StoreID);

AlTER TABLE FactProductSales ADD CONSTRAINT _

FK_CustomerID FOREIGN KEY (CustomerID)REFERENCES

Dimcustomer(CustomerID); AlTER TABLE

FactProductSales ADD CONSTRAINT _ FK_ProductKey

FOREIGN KEY (ProductID)REFERENCES

Dimproduct(ProductKey

);

Populate your Fact table with historical transaction values of sales for the previous day, with proper values o :

Insert into FactProductSales(

SalesInvoiceNumber,SalesDateKey,

SalesTimeKey, SalesTimeAltKey,

StoreID,CustomerID,ProductID SalesPersonID,

Quantity, ProductActualCost,

SalesTotalCost,Deviation

)

Values (StoreID,CustomerID,ProductID

,SalesPersonID,Quantity,

ProductActualCost,

SalesTotalCost, Deviation)

1,20130101,44347,121907,1,1,1,1,2,11,13,2),

(1,20130101,44347,121907,1,1,2,1,1,22.50,24,1.

5)

(1,20130101,44347,121907,1,1,3,1,1,42,43.5,1.5)

(2,20130101,44519,122159,1,2,3,1,1,42,43.5,1.5)

(2,20130101,44519,122159,1,2,4,1,3,54,60,6

),

After executing the above SQL commands, your

sample data warehouse for sales will be ready,

now you can create OLAP Cube on the basis of

this data warehouse.

Create OLAP CUBE

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!