Create database AutomartDW2 Go use AutomartDW2 go Create table DimVehicle ( VehicleID int primary key, VehicleMake nvarchar(255), VehicleYear nvarchar(4) ) go Create table DimCustomer ( RegisteredCustomerKey int primary key, PersonKey int, LastName nvarchar(255), FirstName nvarchar(255), Email nvarchar(255), ) Create table DimVehicleService ( VehicleServiceKey int identity(1,1) primary key, VehicleServiceID int, VehicleID int, LocationName nvarchar(255), ServiceName nvarchar(255), ) Go Create Table DimLocation ( LocationID int primary key, LocationName nvarchar(255), LocationAddress nvarchar(255), LocationCity nvarchar(255), LocationState nchar(2), LocationZip nchar(10), LocationPhone nchar(13) ) go Create Table DimDate ( DateKey int identity (1,1) primary key, ServiceDate Date, ServiceTime Time, sDay int, sMonth int, sYear int ) Create Table DimEmployee ( EmployeeID int primary Key, PersonKey int, HireDate Date, LocationID int, SupervisorID int ) go Create table FactSales ( VehicleID int foreign Key references DimVehicle(VehicleID), DateKey int foreign key references DimDate(DateKey), VehicleServiceKey int foreign Key references DimVehicleService(VehicleServiceKey), RegisteredCustomerKey int foreign key references DimCustomer(RegisteredCustomerKey), EmployeeID int foreign key references DimEmployee (EmployeeID), LocationID int Foreign key references DimLocation (LocationID), ServicePRice money, DiscountPercent decimal(3,2), TaxPercent decimal(3,2), Constraint PK_FactSales primary key (VehicleID, DateKey, VehicleServiceKey, RegisteredCustomerKey, EmployeeID, locationID) )
Thursday, August 7, 2014
Second Version of DataWarehouse
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment