Nested Row Queries
Explore how to use nested row queries in SQL to match multiple columns between tables. Understand applying nested queries with WHERE and FROM clauses to solve practical data retrieval problems involving multi-column conditions and derived tables.
We'll cover the following...
Nested Row Queries
In this lesson we’ll study nested queries that return rows, allowing the outer query to match on multiple different column values. Furthermore, so far, we have used nested queries only with the WHERE clause, but now we’ll also use them with the FROM clause.
Connect to the terminal below by clicking in the widget. Once connected, the command line prompt will show up. Enter or copy and paste the command ./DataJek/Lessons/32lesson.sh and wait for the MySQL prompt to start-up.
-
Let’s say we want to find the list of all the actors whose latest update to any of their online accounts was on the day of their birthday. The date of birth for each actor is in the Actors table and the LastUpdatedOn column is in the DigitalAssets table. We can extract the birthday month and day using the MONTH() and DAY() functions on the DoB column and match them with ...