Practical 5 Slides
Practical 5 Slides
2025-04-08
Understanding MySQL Functions
In WHERE In FROM With IN
Clause Clause and NOT IN
Table Correlated
subqueries subqueries
What is a subquery?
• Definition: A subquery is a query nested within another SQL query,
used to perform intermediate calculations or retrieve data that the
main query will utilize.
Syntax: Syntax:
SELECT columnNames SELECT columnNames
FROM tableName FROM tableName
WHERE condition NOT IN( WHERE condition IN(
SELECT columnName SELECT columnName
FROM tableName); FROM tableName);
With IN and NOT If a subquery returns more than one value, you can
use other operators such as IN or NOT IN operator in
IN operators the WHERE clause.
A subquery that returns multiple rows and columns,
Table Subqueries functioning as a derived table
Correlated A subquery that references columns from the outer
query, executing once for each row processed by the
Subqueries outer query.