Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Subqueries πŸ“

Learning Goals

By the end of this section you will:

  • understand that query results can be used as the basis for further queries.

  • know how to create subqueries to interrogate data across multiple tables.

All SQL queries return a result in the form of a table, and this result table can be used as the basis for another queryβ€”this is called a subquery. Subqueries allow you to build more complex logic by using the output of one query as input for another.

The IN OperatorΒΆ

The SQL IN operator is used to check if a value matches any value in a list or the result of a subquery. Go to the W3schools Tutorial on the IN Operator and complete their exercises.

Note that subqueries can be endlessly nested.