Home >> FAQs/Tutorials >> MySQL Tutorials
MySQL Tutorial - What Is a Subquery
(Continued from previous topic...)
What Is a Subquery?
A subquery is a SELECT statement used as part of the selection criteria
of the main SELECT statement. The subquery specified in the WHERE clause will
be evaluated repeated on each row of the selection base table. The output
of the subquery will be used in the final evaluation of the criteria.
Usually, subqueries are used in the following Boolean operations:
- "expression IN (subquery)"
- "expression NOT IN (subquery)"
- "EXISTS (subquery)"
- "NOT EXISTS (subquery)"
(Continued on next topic...)
- How To Join Two Tables in a Single Query?
- How To Write a Query with an Inner Join?
- How To Define and Use Table Alias Names?
- How To Write a Query with a Left Outer Join?
- How To Write a Query with a Right Outer Join?
- How To Write a Query with a Full Outer Join?
- How To Write an Inner Join with the WHERE Clause?
- How To Name Query Output Columns?
- What Is a Subquery?
- How To Use Subqueries with the IN Operator?
- How To Use Subqueries with the EXISTS Operator?
- How To Use Subqueries in the FROM clause?
- How To Count Groups Returned with the GROUP BY Clause?
- How To Return Top 5 Rows?
- How To Return the Second 5 Rows?
- How To Use UNION to Merge Outputs from Two Queries Together?