Chapter 12. Group Characteristics

LEARNING TO THINK in terms of SQL is a jump for most programmers. Most of your career is spent writing procedural code, and suddenly you have to deal with nonprocedural code. The thought pattern has to change from sequences to sets of data elements. Things happen to various units of work “all at once” in a table, but in file systems and procedural code, records are input from left to right, in sequential order, to be processed by sequential program steps.

Here is how a SELECT works in SQL—at least in theory. Real products will optimize things, but the code has to produce the same results.

  1. Start in the FROM clause and build a working table from all of the joins, unions, intersections, exceptions, and whatever ...

Get Joe Celko's Thinking in Sets: Auxiliary, Temporal, and Virtual Tables in SQL 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.