Summary

Congratulations, you have made it to the end of the day. If your head hurts, don't worry, it's temporary. Today, you learned everything you ever wanted to know about subqueries, but didn't know to ask. You saw how to use subqueries that return single results, as well as subqueries that return lists, and subqueries that do the work of inner joins. In addition, you saw how to use subqueries to return aggregate information, which you would then use in a normal query (one that doesn't use a GROUP BY clause).

You also learned how to use both the IN and EXISTS conditions in the WHERE clause to select data when using subqueries. In tomorrow's lesson, you will learn how to manipulate the data that is in the database by using the INSERT, UPDATE, ...

Get Sams Teach Yourself Transact-SQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.