Content deleted Content added
Remove more irrelevant details about the history and specific implementations, to focus on explaining the model |
Restructure the Overview section to separate high-level definitions, the interpretation of tuples as predicates, and the discussion of constraints. |
||
Line 13:
== Overview ==
The central idea of a relational model is to describe a database as a collection of [[Predicate (mathematical logic)|predicate]]s over a finite set of predicate variables, describing [[constraint (database)|constraints]] on the possible values and combinations of values. The content of the database at any given time is a finite (logical) [[model (logic)|model]] of the database, i.e. a set of [[Relation (database)|relation]]s, one per predicate variable, such that all predicates are satisfied. A request for information from the database (a [[database query]]) is also a predicate.▼
=== Definitions ===
[[File:Relational model concepts.png|thumb|360px|Relational model concepts.]]
The fundamental assumption behind a relational model is that all [[data]] is represented as mathematical ''n''-[[arity|ary]] '''[[Relation (database)|relation]]s''', an ''n''-ary relation being a [[subset]] of the [[Cartesian product]] of ''n'' domains. In the mathematical model, [[reasoning]] about such data is done in two-valued [[predicate logic]], meaning there are two possible [[evaluation]]s for each [[proposition]]: either ''true'' or ''false'' (and in particular no third value such as ''unknown'', or ''not applicable'', either of which are often associated with the concept of [[Null (SQL)|NULL]]). Data are operated upon by means of a [[relational calculus]] or [[relational algebra]], these being equivalent in [[expressive power (computer science)|expressive power]].▼
The relational model of data permits the database designer to create a consistent, logical representation of [[information]]. Consistency is achieved by including declared '''''[[constraint (database)|constraint]]s''''' in the database design, which is usually referred to as the ''logical schema''. The theory includes a process of [[database normalization]] whereby a design with certain desirable properties can be selected from a set of [[Logical equivalence|logically equivalent]] alternatives.▼
The basic relational building block is the [[Data ___domain|___domain]] or [[data type]], usually abbreviated nowadays to '''''type'''''. A ''[[tuple]]'' is an unordered [[set (mathematics)|set]] of '''''attribute values'''''. An [[Attribute (computing)|attribute]] is an unordered pair of '''''attribute name''''' and '''''type name'''''. An attribute value is a specific valid value for the type of the attribute. This can be either a scalar value or a more complex type.
Line 30 ⟶ 27:
The basic principle of the relational model is the [[Information Principle]]: all [[information]] is represented by data values in relations. In accordance with this Principle, a [[relational database]] is a set of relvars and the result of every query is presented as a relation.
=== Constraints ===
The consistency of a relational database is enforced by ''[[constraint (database)|constraint]]s'', declared as part of the logical schema. In general, constraints are expressed using relational comparison operators, of which just one, "is subset of" (⊆), is theoretically sufficient{{Citation needed|reason=This should be explained, because it is interesting enough to read more about it|date=August 2010}}. In practice, several useful shorthands are expected to be available, of which the most important are [[candidate key]] (really, [[superkey]]) and [[foreign key]] constraints.▼
▲The relational model of data permits the database designer to create a consistent, logical representation of [[information]]. Consistency is achieved by including declared '''''[[constraint (database)|constraint]]s''''' in the database design, which is usually referred to as the ''logical schema''. The theory includes a process of [[database normalization]] whereby a design with certain desirable properties can be selected from a set of [[Logical equivalence|logically equivalent]] alternatives.
▲
=== Interpretation ===
To fully appreciate the relational model of data it is essential to understand the intended ''interpretation'' of a [[relation (database)|relation]].
▲The central idea of a relational model is to describe a database as a collection of [[Predicate (mathematical logic)|predicate]]s over a finite set of predicate variables, describing [[constraint (database)|constraints]] on the possible values and combinations of values. The content of the database at any given time is a finite (logical) [[model (logic)|model]] of the database, i.e. a set of [[Relation (database)|relation]]s, one per predicate variable, such that all predicates are satisfied. A request for information from the database (a [[database query]]) is also a predicate.
▲The fundamental assumption behind a relational model is that all [[data]] is represented as mathematical ''n''-[[arity|ary]] '''[[Relation (database)|relation]]s''', an ''n''-ary relation being a [[subset]] of the [[Cartesian product]] of ''n'' domains. In the mathematical model, [[reasoning]] about such data is done in two-valued [[predicate logic]], meaning there are two possible [[evaluation]]s for each [[proposition]]: either ''true'' or ''false'' (and in particular no third value such as ''unknown'', or ''not applicable'', either of which are often associated with the concept of [[Null (SQL)|NULL]]). Data are operated upon by means of a [[relational calculus]] or [[relational algebra]], these being equivalent in [[expressive power (computer science)|expressive power]].
The body of a relation is sometimes called its extension. This is because it is to be interpreted as a representation of the [[extension (predicate logic)|extension]] of some [[Predicate (logic)|predicate]], this being the set of true [[proposition]]s that can be formed by replacing each [[free variable]] in that predicate by a name (a term that designates something).
|