Q&A

Q1: In the examples of subqueries, I noticed quite a bit of indentation. Is this necessary in the syntax of a subquery?
A1: Absolutely not. The indentation is used merely to break the statement into separate parts, making the statement more readable and easier to follow.
Q2: Is there a limit on the number of embedded subqueries that can be used in a single query?
A2: Limitations such as the number of embedded subqueries allowed and the number of tables joined in a query are specific to each implementation. Some implementations may not have limits, although the use of too many embedded subqueries could drastically hinder SQL statement performance. Most limitations are affected by the actual hardware, CPU speed, and system memory available, although there are many other considerations.
Q3: It seems that debugging a query with subqueries can prove to be very confusing, especially with embedded subqueries. What is the best way to debug a query with subqueries?
A3: The best way to debug a query with subqueries is to evaluate the query in sections. First, evaluate the lowest-level subquery, and then work your way to the main query (the same way the database evaluates the query). When you evaluate each subquery individually, you can substitute the returned values for each subquery to check your main query's logic. An error with a subquery is often the use of the operator used to evaluate the subquery, such as (=), IN, >, <, and so on.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset