29.9. Calendar Auxiliary Table

Auxiliary tables are a way of building functions that would be difficult if not impossible to do with the limited computational power of SQL. They should not appear on the E-R diagrams for the database, because they are not really a part of the model but serve as adjuncts to all the tables and queries in the database that could use them.

This is very true with the calendar, because it is so irregular that trying to figure out dates via computations is insanely complex. Look up the algorithms for finding Easter, Ramadan, and other lunar holidays, for example.

Consider the Security and Exchange Commission (SEC) rule that a brokerage transaction must close within three business days. A business day does not include ...

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.