Answer :
Answer:
Below are the SQL queries on AdventureWorks database-
1) Production.Product table is used to get ProductID of LL Road Frame – Black 60.
SELECT pp.ProductID
FROM Production.Product AS pp
WHERE pp.Name = 'LL Road Frame - Black 60';
2) ListPrice from table Production.Product table is listed here.
SELECT pp.ListPrice
FROM Production.Product AS pp
WHERE pp.Name = 'LL Road Frame - Black 60';
3) Same as above except one condition is added to WHERE clause to filter those listPrice without null values.
SELECT pp.ListPrice
FROM Production.Product AS pp
WHERE pp.Name = 'LL Road Frame - Black 60'
AND pp.ListPrice IS NOT NULL;
4) Aggregate function COUNT is used here to get the total order quantity of product LL Road Frame – Black 60.
SELECT COUNT(od.SalesOrderDetailID) AS OrderQty
FROM Production.Product AS pp
INNER JOIN Sales.SalesOrderDetail AS od
ON od.ProductID = pp.ProductID
WHERE pp.Name = 'LL Road Frame - Black 60';
Answer:
Below are the SQL queries on AdventureWorks database-
1) Production.Product table is used to get ProductID of LL Road Frame – Black 60.
SELECT pp.ProductID
FROM Production.Product AS pp
WHERE pp.Name = 'LL Road Frame - Black 60';
2) ListPrice from table Production.Product table is listed here.
SELECT pp.ListPrice
FROM Production.Product AS pp
WHERE pp.Name = 'LL Road Frame - Black 60';
3) Same as above except one condition is added to WHERE clause to filter those listPrice without null values.
SELECT pp.ListPrice
FROM Production.Product AS pp
WHERE pp.Name = 'LL Road Frame - Black 60'
AND pp.ListPrice IS NOT NULL;
4) Aggregate function COUNT is used here to get the total order quantity of product LL Road Frame – Black 60.
SELECT COUNT(od.SalesOrderDetailID) AS OrderQty
FROM Production.Product AS pp
INNER JOIN Sales.SalesOrderDetail AS od
ON od.ProductID = pp.ProductID
WHERE pp.Name = 'LL Road Frame - Black 60';
Explanation: