Part 1 Using the AdventureWorks database and the Production schema create a view that returns Name from the Products table, Name from the ProductCategory table, Name from the ProductSubCategory table, and Quantity from the ProductInventory table. Use appropriate aliases for the columns. Inspect the tables to determine the join conditions. Take a screen shot of the SQL windows and results and paste it here.
Part 2 Write a query to select rows from the above view returning only rows where the name in the ProductSubCategory table contains ‘bikes’. Take a screen shot of the SQL windows and results and paste it here.
Part 3 Alter the view created in Part 1 to include the ListPrice from the Products table and only returns rows with a ListPrice greater than 2000 dollars. Take a screen shot of the SQL windows and results and paste it here.
Part 4 Write a query to select rows from the above view returning only rows where the ListPrice is greater than 2000 but less than 3000 dollars. Take a screen shot of the SQL windows and results and paste it here.
Please help me to solve this questions.

Respuesta :

For Part one: the code is:

CREATE VIEW ProductView AS

SELECT p.Name AS ProductName, pc.Name AS ProductCategoryName, psc.Name AS ProductSubCategoryName, pi.Quantity

FROM Production.Product AS p

INNER JOIN Production.ProductCategory AS pc ON p.ProductCategoryID = pc.ProductCategoryID

INNER JOIN Production.ProductSubCategory AS psc ON p.ProductSubcategoryID = psc.ProductSubcategoryID

INNER JOIN Production.ProductInventory AS pi ON p.ProductID = pi.ProductID;

For Part 2:

SELECT * FROM ProductView

WHERE ProductSubCategoryName LIKE '%bikes%';

For Part 3:

CREATE VIEW ProductView AS

SELECT p.Name AS ProductName, pc.Name AS ProductCategoryName, psc.Name AS ProductSubCategoryName, pi.Quantity, p.ListPrice

FROM Production.Product AS p

INNER JOIN Production.ProductCategory AS pc ON p.ProductCategoryID = pc.ProductCategoryID

INNER JOIN Production.ProductSubCategory AS psc ON p.ProductSubcategoryID = psc.ProductSubcategoryID

INNER JOIN Production.ProductInventory AS pi ON p.ProductID = pi.ProductID

WHERE p.ListPrice > 2000;

Part 4:

SELECT * FROM ProductView

WHERE ListPrice > 2000 AND ListPrice < 3000;

Learn more about coding from

https://brainly.com/question/23275071

#SPJ1