Advanced SELECT Statements
In the previous chapter, we took a look at the basic SELECT statement. Now we need to look at other ways to nest subqueries and build the working table in the FROM clause with other syntax.
25.1 Correlated Subqueries
One of the classics of software engineering is a short paper by the late Edsger Dijkstra entitled “Go To Statement Considered Harmful” (Communications of the ACM, Vol. 11, No. 3, March 1968, pp. 147–148). In this paper he argued for dropping the GOTO statement from programming languages in favor of what we now called Structured Programming.
One of his observations was that programs that used only BEGIN-END blocks, WHILE loops, and IF-THEN-ELSE statements were easier to read and maintain. Programs that jumped ...
Get Joe Celko's SQL for Smarties, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.