From the course: From Excel to SQL

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Advanced subqueries in SQL

Advanced subqueries in SQL

From the course: From Excel to SQL

Start my 1-month free trial

Advanced subqueries in SQL

- So we know that subqueries let you drill down on specific results within a single table. In the SQL query you can see here, I'm using a subquery to find the highest number of vacation days taken by any employee and then returning those employees that match those many days. Now, we take this a step further and made subqueries do even more by combining data from two or more tables. So let's imagine that you want to find all the employees who work in the same state, let's say California. Okay, let's use DB Browser to help us figure out how we can answer this question. Because we're going to be working with data from multiple tables, it's a good idea to just take a quick look at the relationships between those tables. So to start, let's look at the Employees table in the Browse data tab. Now remember, we're trying to identify employees who work in California. But as you can see, there's no state information in the…

Contents