Multi-Layer Nested Subquery

Function

This statement is used to nest queries in the subquery.

Syntax

1
SELECT attr_expr FROM ( SELECT attr_expr FROM ( SELECT attr_expr FROM... ... ) [alias] ) [alias];

Keyword

Precautions

Example

To return the name field from the user_info table after three queries, run the following statement:

1
SELECT name FROM ( SELECT name, acc_num FROM ( SELECT name, acc_num, password FROM ( SELECT name, acc_num, password, bank_acc FROM user_info) a ) b ) c;