From the course: SQL Essential Training

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

IN clause subquery

IN clause subquery - SQL Tutorial

From the course: SQL Essential Training

IN clause subquery

Up to this point, we've only used subqueries to calculate a singular value, which is then passed to the outer query. It is possible to use subqueries that return multiple records. Now let's say that our WSDA music management team is interested in three particular invoices. To select these individual invoices, Let's consider our present SQL statement here. We've used a SQL statement that is going to employ the in operator or the in clause to select three specific invoices. And our result is showing the invoice date that is associated with these three invoices. Now, let's say that we are asked if any purchases were made on these particular days. If we want to select all invoices for those three days, we can either start a brand new query or we can just use our existing query here as a sub query. Let's go ahead and do that. Now, to create a sub query, as we said, let's put our existing query in a pair of parentheses. Open at the start and close at the end. With this step taken, Let's now…

Contents