2
$\begingroup$

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.

$\endgroup$
0

4 Answers 4

4
$\begingroup$

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).

$\endgroup$
2
$\begingroup$

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.

$\endgroup$
1
$\begingroup$

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

$\endgroup$
0
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.