Using Sub-Selects to avoid FROM-clause inefficiencies in SQL

While i’m on perl.com, here’s an interesting article that probably relates to my recent MySQL (>4.1) projects:

Stéphane Faroult’s article, “How to Misuse SQL’s FROM Clause”. The problem queries involve using the FROM clause to list tables from which no data is returned. These examples can be spotted by the use of DISTINCT to un-join the result set.

While MySQL just recently started supporting sub-select syntax, this detailed description of correlated vs. uncorrelated sub-selects is good material for troublesome SQL queries.

Leave a Reply