LESSON 6Embedding Subqueries into Queries
A subquery is a query whose results are passed as the argument for another query. Subqueries enable you to bind several queries together. By the end of this lesson, you will be able to do the following:
• Build a subquery.
• Use the keywords EXISTS
, ANY
, and ALL
with your subqueries.
• Build and use correlated subqueries.
In this lesson, we will be working with the PART
and ORDERS
tables. To ensure that you have these tables created and that data has been inserted into them, please do the following in your MySQL database. The database bob in the following example should be substituted with the name of the database you created and into which you have been putting your tables:
Input/Output
You will need ...
Get Sams Teach Yourself SQL in One Hour a Day, Fifth 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.