Table (database): Difference between revisions
Mx. Granger (talk | contribs) removing citation to Wiki Answers, which is not a reliable source |
removed references to specific vendors syntax. reorder and titled some sections |
||
Line 3: | Line 3: | ||
A [[Table (information) |table]] is a collection of related data held in a structured format within a [[database]]. It consists of [[Field (computer science) |field]]s ([[Column (database) |columns]]), and [[row (database)|rows]]. |
A [[Table (information) |table]] is a collection of related data held in a structured format within a [[database]]. It consists of [[Field (computer science) |field]]s ([[Column (database) |columns]]), and [[row (database)|rows]]. |
||
In [[relational database]]s and [[flat file database]]s, a '''table''' is a set of data elements (values) using a model of vertical [[column (database)|columns]] (which are identified by their name) and horizontal [[row (database)|rows]], the [[cell (database)|cell]] being the unit where a row and column intersect.<ref>{{Citation | url = http://www.merriam-webster.com/dictionary/cell | type =definition | contribution = cell | title = Merriam-Webster | accessdate = May 29, 2012}}.</ref> A table has a specified number of columns, but can have any number of rows.<ref>{{cite web|title=SQL Guide: Tables, rows, and columns|url=http://publib.boulder.ibm.com/infocenter/soliddb/v6r3/index.jsp?topic=/com.ibm.swg.im.soliddb.sql.doc/doc/tables.rows.and.columns.html|work=IBM|accessdate=11 December 2013}}</ref> Each row is identified by |
In [[relational database]]s and [[flat file database]]s, a '''table''' is a set of data elements (values) using a model of vertical [[column (database)|columns]] (which are identified by their name) and horizontal [[row (database)|rows]], the [[cell (database)|cell]] being the unit where a row and column intersect.<ref>{{Citation | url = http://www.merriam-webster.com/dictionary/cell | type =definition | contribution = cell | title = Merriam-Webster | accessdate = May 29, 2012}}.</ref> A table has a specified number of columns, but can have any number of rows.<ref>{{cite web|title=SQL Guide: Tables, rows, and columns|url=http://publib.boulder.ibm.com/infocenter/soliddb/v6r3/index.jsp?topic=/com.ibm.swg.im.soliddb.sql.doc/doc/tables.rows.and.columns.html|work=IBM|accessdate=11 December 2013}}</ref> Each row is identified by one or more values appearing in a particular column subset. The columns subset which uniquely identifies a row is called the [[primary key]]. |
||
Table is another term for [[relation (database)|relation]]; although there is the difference in that a table is usually a [[multiset]] (bag) of rows where a relation is a set and does not allow duplicates. Besides the actual data rows, tables generally have associated with them some [[metadata]], such as [[Check constraint|constraints]] on the table or on the values within particular columns.{{Dubious|reason=Metadata is "data about data". A check constraint doesn't have sich property|date=September 2012}} |
Table is another term for [[relation (database)|relation]]; although there is the difference in that a table is usually a [[multiset]] (bag) of rows where a relation is a set and does not allow duplicates. Besides the actual data rows, tables generally have associated with them some [[metadata]], such as [[Check constraint|constraints]] on the table or on the values within particular columns.{{Dubious|reason=Metadata is "data about data". A check constraint doesn't have sich property|date=September 2012}} |
||
The data in a table does not have to be physically stored in the database. [[view (database)|Views]] are also relational tables, but their data are calculated at query time. |
The data in a table does not have to be physically stored in the database. [[view (database)|Views]] are also relational tables, but their data are calculated at query time. |
||
==Comparisons== |
|||
⚫ | In non-relational systems, [[hierarchical model|hierarchical databases]], the distant counterpart of a table is a structured [[computer file|file]], representing the rows of a table in each record of the file and each column in a record. This structure implies that a record can have repeating information, generally in the child data segments. Data are stored in sequence of records, which are equivalent to table term of a relational database, with each record having equivalent rows. |
||
⚫ | |||
==Tables versus relations== |
==Tables versus relations== |
||
Line 19: | Line 14: | ||
An equally valid representations of a relation is as an ''n''-dimensional [[Graphic#Graphs|chart]], where ''n'' is the number of attributes (a table's columns). For example, a relation with two attributes and three values can be represented as a table with two columns and three rows, or as a two-dimensional graph with three points. The table and graph representations are only equivalent if the ordering of rows is not significant, and the table has no duplicate rows. |
An equally valid representations of a relation is as an ''n''-dimensional [[Graphic#Graphs|chart]], where ''n'' is the number of attributes (a table's columns). For example, a relation with two attributes and three values can be represented as a table with two columns and three rows, or as a two-dimensional graph with three points. The table and graph representations are only equivalent if the ordering of rows is not significant, and the table has no duplicate rows. |
||
== |
==Comparisons== |
||
Two types of tables exist: |
|||
* A [[relational table]], which is the basic structure to hold user data in a [[relational database]]. |
|||
* An [[object table]], which is a table that uses an object type to define a column. It is defined to hold instances of objects of a defined type. |
|||
===Hierarchical Databases=== |
|||
In SQL, the <code>CREATE TABLE</code> statement creates these tables.<ref>{{cite book|title= Oracle Database SQL Reference 10g Release 1 (10.1)| first1 =Diana | last1 = Lorentz | first2 = Joan | last2 = Gregoire |chapter = CREATE TABLE | publisher=Oracle |date=December 2003|url=http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_7002.htm#i2095331|id=Part Number B10759-01}}</ref> |
|||
⚫ | In non-relational systems, [[hierarchical model|hierarchical databases]], the distant counterpart of a table is a structured [[computer file|file]], representing the rows of a table in each record of the file and each column in a record. This structure implies that a record can have repeating information, generally in the child data segments. Data are stored in sequence of records, which are equivalent to table term of a relational database, with each record having equivalent rows. |
||
===Spreadsheets=== |
|||
⚫ | |||
==See also== |
==See also== |
||
* [[SQL]] |
|||
* [[Relation (database)]] |
* [[Relation (database)]] |
||
* [[Row (database)]] |
* [[Row (database)]] |
Revision as of 11:43, 29 January 2015
This article needs additional citations for verification. (December 2009) |
A table is a collection of related data held in a structured format within a database. It consists of fields (columns), and rows.
In relational databases and flat file databases, a table is a set of data elements (values) using a model of vertical columns (which are identified by their name) and horizontal rows, the cell being the unit where a row and column intersect.[1] A table has a specified number of columns, but can have any number of rows.[2] Each row is identified by one or more values appearing in a particular column subset. The columns subset which uniquely identifies a row is called the primary key.
Table is another term for relation; although there is the difference in that a table is usually a multiset (bag) of rows where a relation is a set and does not allow duplicates. Besides the actual data rows, tables generally have associated with them some metadata, such as constraints on the table or on the values within particular columns.[dubious – discuss]
The data in a table does not have to be physically stored in the database. Views are also relational tables, but their data are calculated at query time.
Tables versus relations
In terms of the relational model of databases, a table can be considered a convenient representation of a relation, but the two are not strictly equivalent. For instance, an SQL table can potentially contain duplicate rows, whereas a true relation cannot contain duplicate tuples. Similarly, representation as a table implies a particular ordering to the rows and columns, whereas a relation is explicitly unordered. However, the database system does not guarantee any ordering of the rows unless an ORDER BY
clause is specified in the SELECT
statement that queries the table.
An equally valid representations of a relation is as an n-dimensional chart, where n is the number of attributes (a table's columns). For example, a relation with two attributes and three values can be represented as a table with two columns and three rows, or as a two-dimensional graph with three points. The table and graph representations are only equivalent if the ordering of rows is not significant, and the table has no duplicate rows.
Comparisons
Hierarchical Databases
In non-relational systems, hierarchical databases, the distant counterpart of a table is a structured file, representing the rows of a table in each record of the file and each column in a record. This structure implies that a record can have repeating information, generally in the child data segments. Data are stored in sequence of records, which are equivalent to table term of a relational database, with each record having equivalent rows.
Spreadsheets
Unlike a spreadsheet, the datatype of field is ordinarily defined by the schema describing the table. Some SQL systems, such as SQLite, are less strict about field datatype definitions.
See also
References
- ^ "cell", Merriam-Webster (definition), retrieved May 29, 2012.
- ^ "SQL Guide: Tables, rows, and columns". IBM. Retrieved 11 December 2013.