# Is a relational database just a $\geq 2$-dimensional array?

In terms of comparing data structures, is a relational database just a >1 dimensional array? I'm just asking because I don't know much about databases, but I know a bit about data structures.

I am trying to make this clear in my mind.

-

## migrated from cstheory.stackexchange.comFeb 14 '13 at 8:52

This question came from our site for theoretical computer scientists and researchers in related fields.

No, it isn't. A data structure can be described in two ways:

1. How does it store the data.
2. Which operations are supported, their performance (usually given as asymptotic time- and/or space-complexity), and what laws do they obey.

Obviously, a database doesn't store all its data as a single array.

Arrays support, as basic operations, retrieving an element by index and storing an element under an index. Operations required for databases are (to a first approximation) given by relational algebra: selection, projection, union, difference, and join (or product).

-

Technically, you could say that a database can be represented as a huge array. The benefit of a DB, however, is the ability to represent this huge array very succinctly.

More theoretically, the benefit of a DB can be compared to the topological fact that cylinder sets can be represented succinctly, as opposed to more complex subsets. Essentially, a DB is a representation of a cylinder set as a multiplication of its respective dimensions.

-

In database literature this idea is widely known as universal relation.

-

There is some basic similarity between relational DB and large array (table~multidimensional array).

Relational DB is based on relational algebra which makes it powerful. By using relational operators, information could be retrieved, updated, inserted, deleted etc... in DB efficiently.

Considering array as a simple data structure, it only supports read/write operators in constant time $O(1)$. while in relational db you can write lots of complex queries using relational algebra.

-