Professional Documents
Culture Documents
Lab 06
Lab 06
Overview
In this lab, you will use subqueries and the APPLY operator to retrieve data from the AdventureWorksLT
database.
Before starting this lab, you should view Module 6 Using Subqueries and APPLY in the Course
Querying with Transact-SQL. Then, if you have not already done so, follow the instructions in the Getting
Started document for this course to set up the lab environment.
If you find some of the challenges difficult, dont worry you can find suggested solutions for all of the
challenges in the Lab Solution folder for this module.
1. Retrieve products whose list price is higher than the average unit price
Retrieve the product ID, name, and list price for each product where the list price is higher than the
average unit price for all products that have been sold.
2. Retrieve Products with a list price of $100 or more that have been sold for less than
$100
Retrieve the product ID, name, and list price for each product where the list price is $100 or more, and
the product has been sold for less than $100.
3. Retrieve the cost, list price, and average selling price for each product
Retrieve the product ID, name, cost, and list price for each product along with the average unit price for
which that product has been sold.
4. Retrieve products that have an average selling price that is lower than the cost
Filter your previous query to include only products where the cost price is higher than the average
selling price.
Tip: Review the documentation for the APPLY operator in Using APPLY.
Next Steps
Well done! Youve completed the lab, and youre ready to learn how to use table expressions in Module
7 Using Table Expressions in the Course Querying with Transact-SQL.