Database table

from Wikipedia, the free encyclopedia

A database table is a collection of related data that is stored in a database in a structured format . It consists of columns and rows. The number of columns is fixed, the number of rows is arbitrary.

Database tables in relational databases

Relational Database Terms

Database tables play an important role in the context of relational databases . A database table represents a database relation . The relation is the namesake and basis of the relational databases.

The rows are called tuples , the columns are called attributes. The description of the database table is the relation schema and defines the type of attributes. A database table can contain so-called primary keys , which consist of one or more attributes. A primary key is a unique name for a data record. In addition to the primary key, it can contain foreign keys that refer to the primary key or, in rare cases, other attributes of another table. A table that does not contain foreign keys is called a "flat table".

Example of creating a database table in SQL:

CREATE TABLE buecher (
    Buchnummer     int PRIMARY KEY,
    Autor          varchar(80),
    Verlag         varchar(80),
    Verlagsjahr    int,
    Titel          varchar(250),
    Datum          date
);

Example for the contents of the previously created database table:

Book number author publishing company Publishing year title date
123456 Hans prolific writer Sample publisher 2007 We learn SQL 13/01/2007
123457 J. Gutenberg Gutenberg and Co. 1452 Printing made easy 01/01/1452
123458 Galileo Galilei Inquisition International 1640 Eppur si muove 1641
123459 Charles Darwin Vatican Publishing House 1860 Adam and Eve 1862

See also