Max. number of subqueries with WHERE clause in MySQL

2.1k Views Asked by At

What is the value of maximum number of sub-queries that can be written in WHERE clause? Is it dependent on the RDBMS or the number of attributes of the table?

2

There are 2 best solutions below

0
On

The ANSI SQL standard does not specify a maximum number of subqueries in the where clause. Any such limitation, if exits, would be RDBMS-specific.

0
On

As already said by Murenik, there is no such limitation from ANSI standard but specific RDBMS may restrict like

SQL Server says

Up to 32 levels of nesting is possible, although the limit varies based on available memory and the complexity of other expressions in the query. Individual queries may not support nesting up to 32 levels.

MySQL doesn't say anything about any such limits

Oracle Says

Subqueries: Maximum levels of subqueries in a SQL statement : Unlimited in the FROM clause of the top-level query