Relational model: Difference between revisions

Content deleted Content added
Move the Alternatives section to the top-level, instead of nesting it in the Overview section
Merge Overview and Topic into one section. There's no need for a both a Lead and an Overview before actually explaining the model
Line 5:
 
Most relational databases use the [[SQL]] data definition and query language; these systems implement what can be regarded as an engineering approximation to the relational model. A ''table'' in a SQL [[database schema]] corresponds to a predicate variable; the contents of a table to a relation; key constraints, other constraints, and SQL queries correspond to predicates. However, SQL databases [[#SQL and the relational model|deviate from the relational model in many details]], and Codd fiercely argued against deviations that compromise the original principles.<ref>{{Citation | first = E. F | last = Codd | title = The Relational Model for Database Management | publisher = Addison-Wesley | year = 1990 | isbn = 978-0-201-14192-4 | pages=371–388}}.</ref>
 
== 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.
[[File:Relational model concepts.png|thumb|360px|Relational model concepts.]]
 
 
 
Line 19 ⟶ 14:
Some years after publication of his 1970 model, Codd proposed a [[three-valued logic]] (True, False, Missing/[[Null (SQL)|NULL]]) version of it to deal with missing information, and in his ''The Relational Model for Database Management Version 2'' (1990) he went a step further with a four-valued logic (True, False, Missing but Applicable, Missing but Inapplicable) version.<ref>{{cite book| first =Christopher J. | last = Date|title=Date on Database: Writings 2000–2006|date= 2006 |publisher= Apress|isbn= 978-1-59059-746-0|pages=329–41|chapter= 18. Why Three- and Four-Valued Logic Don't Work}}</ref>
 
== TopicsOverview ==
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.
[[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]].