Question
Modify the tables in the Reporting_Schema to prepare them for reporting. Create a script to do the following. Save your script with the name, Modify
Modify the tables in the Reporting_Schema to prepare them for reporting. Create a script to do the following. Save your script with the name, "Modify Warehouse". Include a screen snip of your completed script in your solution file.
Alter the three tables to set up a primary key constraint for CustomerID in Customer, SalesOrderID in SalesOrderheader and a composite key of SalesOrderID and SalesOrderDetailID in the SalesOrderDetail table.
Add a foreign key constraint to SalesOrderHeader on CustomerID referencing the CustomerID primary key column in Customers.
Add a foreign key constraint to SalesOrderDetail on SalesorderID referencing SalesOrderID in the SalesOrderHeader table.
the script should look like the following....
Please answer in SQL.
Buse FVTCSalesDB. EIF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N' [reporting_schema]. [customer]') AND OBJECTPROPERTY ( id, N'IsUserTable') = 1) DROP TABLE [reporting_schema]. [customer] select into reporting schema.customer from saleslt.customer BIF EXISTS (SELECT FROM dbo.sysobjects WHERE id = OBJECT_ID (N' [reporting_schema]. [salesorderheader]') AND OBJECTPROPERTY (id, N'IsUser Table') = 1) DROP TABLE [reporting_schema]. [salesorderheader] select into reporting schema.salesorderheader from saleslt.salesorderheader EIF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N' [reporting_schema]. [salesorderdetail]') AND OBJECTPROPERTY (id, N'IsUserTable') = 1) DROP TABLE [reporting_schema].[salesorderdetail] select into reporting schema.salesorderdetail from saleslt.salesorderdetail
Step by Step Solution
3.41 Rating (151 Votes )
There are 3 Steps involved in it
Step: 1
ALTER TABLE Customer ADD PRIMARY KEY CustomerlD ALTER TABLE Sales OrderHea...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started