In this SQL lesson, you’ll learn how to write complex, nested queries using subqueries. Being able to write complex SQL queries is a skill that every data analyst and data scientist needs to know

Often, the data you will want is not easily obtainable using a single query. As you progress through your data analyst or data scientist career, you'll notice that you need to be able to write a subquery, or a query inside another query, to get the data you want to look at in the format you want it. 

In this lesson, you will learn what subqueries are and how they can be beneficial as you write more and more queries. As you start this lesson, you will see the basic form of a subquery and learn to write your own to complete each exercise. You'll also learn about using the `IN` operator to check for membership within a group, and about how the `IN` operator can be used to subquery data.

As with previous lessons in this course, you’ll be working with the 2010-2012 college grad data to answer real-world data science questions as you practice your SQL skills and get more comfortable with writing complex queries as part of a data science workflow.


  • Learn how to use subqueries to nest queiries in the SELECT clause.
  • Learn how to use subqueries to nest queries in the WHERE clause.

Mission Outline

1. Writing More Complex Queries
2. Subqueries
3. Calculating Proportions With Subqueries
4. Using the IN Operator
5. Building Complex Subqueries
6. Practice Integrating A Subquery With The Outer Query
7. Next Steps
8. Takeaways


Course Info:


The median completion time for this course is 3.5 hours. ​View Details​​​

This course requires a basic subscription and includes four missions and one guided project.  It is the fifth course in the ​Data Analyst in R Path​​​


Take a Look Inside