# Working with Sub-Queries

In the previous chapter, we learned how to combine data from multiple tables by using JOINs. Another approach to filtering or combining data is through the use of sub-queries. This is essentially the process of combining multiple smaller queries instead of creating a single large query. Most complex queries can be written either by using JOIN clauses or by writing one or more sub-queries. There are only a few scenarios where a sub-query is required to return the desired data because the query is not possible by just using JOINs.

Updated: November 16, 2026

## [Working with Sub-Queries](https://www.ask-codey.com/courses/java-full-stack-bootcamp/topics/working-with-sub-queries)

1. [Types of Sub-Queries](https://www.ask-codey.com/lessons/working-with-sub-queries-types-of-sub-queries) (Journeyman): The difference between an uncorrelated sub-query, which runs once on its own, and a correlated sub-query, which runs once for each row of the outer query.
2. [Where to use Sub-Queries](https://www.ask-codey.com/lessons/working-with-sub-queries-where-to-use-sub-queries) (Journeyman): Where a sub-query can go, as a lookup value or list in WHERE, an EXISTS check, a column value, or a table to join.

## [The CASE / WHEN Statement](https://www.ask-codey.com/courses/java-full-stack-bootcamp/topics/the-case-when-statement)

1. [The CASE / WHEN Statement](https://www.ask-codey.com/lessons/the-case-when-statement) (Journeyman): How a CASE expression turns values into labels, such as HIGH or LOW, in a query's results.

Source: https://www.ask-codey.com/courses/java-full-stack-bootcamp/chapters/working-with-sub-queries
