0% found this document useful (0 votes)
16 views4 pages

Day 5 Mysql Subquery: #56daysofsql

Uploaded by

Rkpande20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views4 pages

Day 5 Mysql Subquery: #56daysofsql

Uploaded by

Rkpande20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

#56daysofSQL

Day 5

MySQL Subquery

Aditya Shenoy
#56daysofSQL

Subqueries

A MySQL subquery is a query nested

within another query such as

𝚂𝙴𝙻𝙴𝙲𝚃, 𝙸𝙽𝚂𝙴𝚁𝚃, 𝚄𝙿𝙳𝙰𝚃𝙴 or


𝙳𝙴𝙻𝙴𝚃𝙴.
A MySQL subquery is called an inner

query while the query that contains

the subquery is called an outer query.

The inner query executes first before

its parent query so that the results of

the inner query can be passed to the

outer query.

Aditya Shenoy
#56daysofSQL

General Syntax :

SELECT select_list
FROM table
WHERE expr_operator
(SELECT select_list
FROM table) ;

In this Syntax:

The subquery (inner query) executes once

before the main query (outer query) executes.

The main query (outer query) use the subquery

result.

Aditya Shenoy
#56daysofSQL

Use Case Example :

Output :

Aditya Shenoy

You might also like