O'Reilly logo

Joe Celko's SQL for Smarties, 4th Edition by Joe Celko

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

25

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required