Subqueries

A subquery is a query nested in another query.

Title Description
Scalar Subqueries Subquery returning a single value.
Row Subqueries Subquery returning a row.
Subqueries and ALL Return true if the comparison returns true for each row, or the subquery returns no rows.
Subqueries and ANY Return true if the comparison returns true for at least one row returned by the subquery.
Subqueries and EXISTS Returns true if the subquery returns any rows.
Subqueries in a FROM Clause Subqueries are more commonly placed in a WHERE clause, but can also form part of the FROM clause.
Subquery Optimizations Articles about subquery optimizations in MariaDB.
Subqueries and JOINs Rewriting subqueries as JOINs, and using subqueries instead of JOINs.
Subquery Limitations There are a number of limitations regarding subqueries.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.

© 2021 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/subqueries/