Programming

SQL Problem 2

October 19, 2014

So, here’s the continuation of the SQL Problem I posted .. đŸ™‚

Q2. Find the value of each product sold.

Code:

SELECT Product.CostPrice
FROM Product INNER JOIN SalesOrderDetail 
ON Product.ProductNo = SalesOrderDetail.ProductNo;

Output:
Q2

Q2

Q4. Find out the products which has been sold to Ivan.

Code:

SELECT Product.Description, Product.[Qty_on-hand], Client.ClientName
FROM ((Product INNER JOIN SalesOrderDetail ON Product.ProductNo = SalesOrderDetail.ProductNo) 
INNER JOIN SalesOrder ON SalesOrderDetail.SOrderNo = SalesOrder.SOrderNo) INNER JOIN Client 
ON SalesOrder.ClientNo = Client.ClientNo
WHERE Client.ClientName="Ivan" OR Client.ClientName='Vandana';

 

You Might Also Like...

No Comments

    Leave a Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.