21.7. Bitwise Aggregate Functions

A bitwise aggregate function is not a recommended practice, since it will destroy First Normal Form (1NF) by overloading a column with a vector whose components have individual meanings. But it is common enough that I have to mention it. Instead of giving each attribute in the data model its own column, bad programmers will assign a meaning to each bit in the binary representation of an INTEGER or SMALLINT. Some products will actually expose the physical model for the data types and have proprietary bitwise AND and OR operators. Most products do not implement bitwise aggregate Boolean operators, however. But I feel like a furniture maker who is telling you what are the best rocks with which to drive screws into ...

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.