Database (source code)

= Database
{wiki}

A <database> is an organized collection of data maintained for queries and updates. A <database management system> manages that collection, enforcing access rules and <database integrity constraints>. A <relational database> represents it through <database relations>, rather than exposing only an arbitrary collection of bytes in <files>.

For example, a laboratory can store <biological sample> identifiers, <measurement> values and <scientific instrument> identifiers as <database tuples>. A <database query> can select <measurements> above a threshold and join them to <scientific instrument> records. A <foreign key> can require every recorded <scientific instrument> identifier to name an existing <scientific instrument>. This makes the connection a maintained rule rather than a convention that every application must remember.

The logical <relational schema> and actual storage are distinct. A <database query plan> may use an index or scan <database pages> while returning the same specified result. <Database transactions> coordinate related updates, and <database integrity constraints> restrict the permitted states. PostgreSQL's documentation gives a concrete implementation in which named tables contain rows with named, typed columns and databases group tables.<Concepts in the PostgreSQL documentation>[version 18, section 2.2]{ref}