From the course: SQL: Data Reporting and Analysis

Unlock the full course today

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

Select from a selection with subqueries

Select from a selection with subqueries - SQL Tutorial

From the course: SQL: Data Reporting and Analysis

Select from a selection with subqueries

- [Instructor] We've already seen a nested query or a subquery where we use a SELECT statement to place a filter on a broader SELECT statement. And in this section we're going to do something slightly more complex where we use a SELECT statement to return results to another SELECT statement. So here we have a familiar query, SELECT first_name FROM actor and we're going to call that result set f and then we say SELECT F.first_name FROM, like that. And it's returned us the same first names that we had before, as you would expect. So on its own, this query isn't useful but the syntax is useful. And if you come across a query like this you should always try to make sense of it from the inside out. So let's start with the middle part of the query, the bit in brackets, SELECT this column first_name FROM actor and call that result set f. And then from the result set f, return me the first name. If we didn't use an alias here,…

Contents