Languages

MySQL - what is subquery?

0 points
Asked by:
Dirask Community
6240

What is a subquery in MySQL?

1 answer
0 points
Answered by:
Dirask Community
6240

A subquery is a query that is nested inside statements (like SELECT , INSERT , UPDATE , DELETE) or inside another subquery.

It is used to return data that will be used in the main query as a condition to further restrict the data to be retrieved.

Practical example:

SELECT * FROM (
    SELECT * FROM `table_name` 
	ORDER BY `column_name` DESC
	LIMIT N
) subquery
ORDER BY `column_name` ASC;
0 comments Add comment
Native Advertising
­čÜÇ
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

ÔŁĄ´ŞĆ­čĺ╗ ­čÖé

Join