Question: I have created this temp tables in previous assignment: IF OBJECT_ID ('tempdb.dbo.MyProductPriceHistory', 'U') IS NOT NULL DROP TABLE #MyProductPriceHistory; SELECT P.ProductID , P.Name , PLPH.StartDate
I have created this temp tables in previous assignment:
IF OBJECT_ID ('tempdb.dbo.MyProductPriceHistory', 'U') IS NOT NULL
DROP TABLE #MyProductPriceHistory;
SELECT
P.ProductID
, P.Name
, PLPH.StartDate
, isnull(PLPH.EndDate, getdate()) AS EndDate
, PLPH.ListPrice
INTO
#MyProductPriceHistory
FROM
Production.Product AS P
INNER JOIN
Production.ProductListPriceHistory AS PLPH ON P.ProductID = PLPH.ProductID
WHERE P.Name='LL Road Frame - Black, 60'
SELECT * FROM #MyProductPriceHistory
2. IF OBJECT_ID('tempdb.dbo.MySalesOrderDetailbyName', 'U') IS NOT NULL
DROP TABLE #MySalesOrderDetailbyName;
SELECT
P.ProductID
, P.Name
, SOD.SalesOrderID
, SOD.OrderQty AS Quantity
, SOH.OrderDate
INTO
#MySalesOrderDetailbyName
FROM
Production.Product AS P
INNER JOIN
Sales.SalesOrderDetail AS SOD ON P.ProductID = SOD.ProductID
WHERE p.Name='LL Road Frame - Black, 60'
SELECT * FROM #MySalesOrderDetailbyName
Now for this assignment: I need to complete below mentioned two steps:
Part 1
Using what you have learned, replicate the data found in #MySalesOrderDetailbyDate and #MyProductPriceHistory using a single line of SQL code. Using the query completed in the Topic 6 assignment, modify the query and present it in an easy-to-read format. To do this, write the query in two single statements without temporary tables, using abbreviations and line spacing.
Please note that when SQL queries are run, results are generated in the form of data. This data should be exported and saved to Excel for a visual check of accuracy.
Create a Word document that includes the SQL query code.
Part 2
Karen Berge, a Document Control Assistant at the company, comes to you with a request. Karen wants the titles and file names of all of the documents she has produced and has asked you to generate this information for her. Using what you have learned, produce a query in one statement to give her the information she needs. Note that constructing the query will require some thinking outside the box since the relationships are not well documented.
Please advise
Thanks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
