MISSION 255

Subqueries

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.

Objectives

  • 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. 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

sql-fundamentals

Course Info:

Beginner

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

This course requires a basic subscription and includes five missions and one guided project.  It is the 11th course in the Data Analyst in Python path and the Data Scientist in Python path.

START LEARNING FREE

Take a Look Inside