O'Reilly logo

Joe Celko's SQL for Smarties, 4th Edition 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

33

Matrices in SQL

Arrays are not the same thing as matrices. An array is a data structure whose elements are accessed by a numeric value called an index. A matrix is an array with mathematical operations defined on it. A matrix can be one, two, three, or more dimensional structures. The most common mathematical convention has been to use the letters i, j, and k for the indexes.

SQL had neither arrays nor matrices because the only data structure in the Relational Model is a table. Arrays violate the rules of First Normal Form (1NF) required for a relational database, which say that all columns are scalars.

This was unfortunately changed in SQL:2003 with the addition of collection types. You can now declare a column to be an array of one of the ...

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