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 - 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
-
-
-
-
-
-
(Locked)
Make your queries faster1m 47s
-
(Locked)
Understand SQL indexes and keys7m 16s
-
(Locked)
EDIT: Visualize your database7m 58s
-
(Locked)
Merge data across tables with JOIN5m 2s
-
(Locked)
Understand SQL JOINS4m 16s
-
(Locked)
Combine rows with SQL UNION4m 49s
-
(Locked)
Merge data across tables with IN2m 11s
-
(Locked)
Select from a selection with subqueries2m 56s
-
(Locked)
Challenge: Join tables1m 4s
-
(Locked)
Solution: Join tables4m 37s
-
(Locked)
-
-