O'Reilly logo

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

2.1. Grouping Is Not Equality

Go back to step c in the last section. A grouping is not exactly defined by equality. Equality is a comparison between two scalar values, and it follows the rules for that data type.

First of all, consider how equality of strings is defined in SQL. The shorter string is padded out with blanks on the right side until it is the same length as the longer string. The characters are matched position for position, so that ‘Smith’ = ‘Smith’ and so forth. Given a subset of different length strings that all test equal under that rule, which one represents the “Smith group” in the working table?

Second, consider floating-point numbers. Two FLOATs can actually be different but test equal if they are within a certain difference ...

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