Loading topic
SELECT statement nested inside another SQL statement. The inner query produces a result that the outer query uses. This lets you answer a layered question in one statement.2 min readSELECT, WHERE, ORDER BY, aggregate functions such as AVG, and basic joins. You should also understand that NULL means an unknown or missing value.2 min readSELECT, WHERE, JOIN, aggregate functions, and NULL behavior. This chapter focuses on subqueries that return multiple rows.2 min readSELECT queries with WHERE, use subqueries with IN, and understand that NULL means “unknown” or “missing,” not zero or an empty string. It also assumes that you know SQL uses three-valued logic: a condition can be true, false, or unknown.2 min readSELECT and WHERE clauses, use aggregate functions, and work with INNER JOIN and LEFT JOIN. You should also understand that NULL creates an unknown comparison rather than true or false.2 min readSELECT, WHERE, ORDER BY, aggregate functions, GROUP BY, INNER JOIN, LEFT JOIN, NULL, and three-valued logic. A correlated subquery is a subquery that refers to a column from the surrounding, or outer, query. The database evaluates that inner query in the c2 min readSELECT, WHERE, joins, aggregate functions, GROUP BY, NULL, and three-valued logic. This chapter focuses on checking whether related rows exist, rather than returning values from those rows.2 min readSELECT, WHERE, and ORDER BY clauses, use aggregate functions such as COUNT and AVG, and understand JOIN and NULL. You will learn how to put a subquery in the SELECT list to calculate an extra value for every row in the main query.2 min readFROM clause. It produces a temporary result set that the outer query can treat like a table. The derived table exists only while the statement runs.2 min readSELECT, WHERE, GROUP BY, joins, aggregate functions, and NULL. A common table expression, or CTE, is a named query result that exists only while one SQL statement runs. You define a CTE with WITH, then use its name like a temporary table.2 min readSELECT statements with WHERE, use aggregate functions and GROUP BY, join tables, and reason about NULL and three-valued logic. A subquery in a data-modifying statement helps choose which rows to change or remove.2 min readSELECT, WHERE, aggregate functions, GROUP BY, INNER JOIN, LEFT JOIN, NULL, and three-valued logic. This chapter focuses on choosing the clearest way to express the same question.2 min readSELECT, WHERE, joins, ORDER BY, LIMIT, and NULL. A lateral subquery is a subquery in the FROM clause that can refer to columns from a table that appears before it in the same FROM list.2 min readSELECT, joins, aggregates, GROUP BY, NULL, and three-valued logic. This chapter focuses on how subqueries affect execution and how to inspect a database's chosen plan.2 min read