Methods | Statistics | Clinical | Educational | Industrial | Professional items | World psychology |
In relational databases (RDB) - and particularly those based on SQL - a table is a set of data elements (cells) that is organized, defined and stored as horizontal rows and vertical columns where each item can be uniquely identified by a label or key or by it’s position in relation to other items.
A table has a specified number of fields but can have any number of records. Rows stored in a table are structurally equivalent to records from flat files in that they must not contain repeating fields. Most database tables consists of a header, and a main data table. The main data table contains the actual structured data, meaning a value is stored at the intersection of each row and column. The header consists of sets of constraints: one set for the whole table, and (potentially) one set per column.
In non-relational / hierarchical systems, the equivalent of a table is a file, containing records (the rows) and fields (the columns).
Unlike a spreadsheet, a database table can not take arbitrary information in any cell, and nor can values be represented as formulae referring to other cells. The datatype of each field is strictly defined within the DBMS as part of the design of a particular database.
Tables versus relationsEdit
In terms of the relational model of databases, a table can be considered a convenient representation of a relation, but the two are not interchangeable. For instance, an SQL table can potentially contain duplicate rows, whereas a true relation cannot contain duplicate tuples (the equivalent of rows); similarly, representation as a table implies a particular ordering to the rows and columns, whereas a relation is explicitly unordered.
An equally valid representation of a relation is as an n-dimensional graph, where n is the number of attributes (a table's columns). For example, a relation with 2 attributes and 3 values can be represented as a table with 2 columns and 3 rows, or as a 2-dimensional graph with 3 points. Clearly, the table and graph representations are only equivalent if the ordering of rows is not significant, and the table has no duplicate rows.
|This page uses Creative Commons Licensed content from Wikipedia (view authors).|