11.2. Rozenshtein Characteristic Functions

A characteristic function converts a logical expression into a one if it is TRUE and to a zero if it is FALSE. This is what we have been doing with some of the CASE expressions shown here, but not under that name. The literature uses a lowercase delta (δ) or a capital chi (X) as the symbol for this operator. Programmers first saw this in Ken Iverson’s APL programming language, and then later in Donald Knuth’s books on programming theory. The name comes from the fact that it is used to define a set by giving a rule for membership in the set.

David Rozenshtein found ways of implementing characteristic functions with algebraic expression on numeric columns in the Sybase T-SQL language (Rozenshtein 1995) ...

Get Joe Celko's SQL for Smarties, 3rd 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.