| Lesson 6 | Sub-SELECT statements and options |
| Objective | Examine two options for using sub-SELECT statements. |
When you use the sub-SELECT approach, you have two options.
You can use an IN clause, as shown in the example shown in the previous lesson, or you can use the EQUAL qualifier.
Your choice will depend on a simple question:
Question: Are you expecting your sub-SELECT statement to return only one value, or several?
Some examples will help explain.
You can use an IN clause, as shown in the example shown in the previous lesson, or you can use the EQUAL qualifier.
Your choice will depend on a simple question:
Question: Are you expecting your sub-SELECT statement to return only one value, or several?
First, with sub-SELECT statements, it is important to understand that the SELECT statement you put in the parentheses is executed first, then the
results are used to work with the outer SELECT statement.
Let us take another look at how the sub-SELECT statement from the previous lesson works.
Examine the SlideShow below to see the evaluation process for a sub-SELECT statement.
Let us take another look at how the sub-SELECT statement from the previous lesson works.
Examine the SlideShow below to see the evaluation process for a sub-SELECT statement.
An alternate version is available at the following link:
Sub-select options.
Sub-select options.