25.3. Matrix Operations in SQL

A matrix is not quite the same thing as an array. Matrices are mathematical structures with particular properties. We cannot take the time to discuss them here; you can find the necessary information in a college freshman algebra book. Though it is possible to do many matrix operations in SQL, it is not a good idea; such queries and operations will eat up resources and run much too long. SQL was never meant to be a language for calculations.

Let us assume that we have two-dimensional arrays that are declared as tables using two columns for subscripts, and that all columns are declared with a NOT NULL constraint.

The presence of NULLs is not defined in linear algebra, and I have no desire to invent a three-valued ...

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.