Wednesday, January 15, 2014

Chapter 4 homework

Homework Q's written from my phone so excuse typing errors.  All use TSQL2012 DB.

1) Use production.products table to group products by categoryid, and returns for each category the minimum unit price. 

2) define a CTE based on question 1 and join the CTE to the production.products table to return per each category the products with the minimum unit price.

3) write query that return suppliers from japan and the products they supply using production.suppliers table and production.products. Need, product name, id, and unit price.

4) -- Bad Question --

5)write a query that finds customers who placed orders on February 12, 2007. Using sales.customers, custid, company name; and sales.orders, order date… join on custid

6)create ITV function (anyname) with input as @empid INT, that returns a Table.

7)write query that returns the two products with the lowest unit price for supplier 1 using production.products table. Select productid, product name, unit price.

8)use query in question 7 and cross apply it to suppliers from japan that you have in the production.suppliers table. 

No comments:

Post a Comment