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.

Lesson Outline

  1. Writing More Complex Queries
  2. Subqueries
  3. Subquery In SELECT
  4. Returning Multiple Results In Subqueries
  5. Building Complex Subqueries
  6. Practice Integrating A Subquery With The Outer Query
  7. Next Steps
  8. Takeaways

Get started for free

No credit card required.

Or With

By creating an account you agree to accept our terms of use and privacy policy.