[go: nahoru, domu]

Relational database: Difference between revisions

Content deleted Content added
See also: Datalog
I introduced the acronym FK.
 
(11 intermediate revisions by 11 users not shown)
Line 3:
{{more citations needed| date=January 2024| reason=some refs but tech article needs more}}
 
A '''relational database''' is('''RDB'''<!-- anecessary (mostto commonlymaintain digitalan inbound link from DAB [[RDB]] --><ref>{{Cite conference |title=Portable Software Tools for Managing and Referencing Taxonomies |conference=Digital Mapping Techniques '03 Workshop Proceedings|at=2. Relational Database Technology and Taxonomic Representation |date=2003 |url=https://pubs.usgs.gov/of/2003/of03-471/hastings/index.html |conference-url=https://pubs.usgs.gov/of/2003/of03-471/ |last=Hastings |first=Jordan |volume=U.S. Geological Survey Open-File Report 03–471 |access-date=2024-04-06 |url-status=live |archive-url=https://web.archive.org/web/20141021070621/https://pubs.usgs.gov/of/2003/of03-471/hastings/index.html |archive-date=2014-10-21 |via=[[United States Geological Survey]]}}</ref>) is a [[database]] based on the [[relational model]] of data, as proposed by [[E. F. Codd]] in 1970.<ref name=codd/> A [[DBMS|database management system]] used to maintain relational databases is a '''relational database management system''' ('''RDBMS'''). Many relational database systems are equipped with the option of using [[SQL]] (Structured Query Language) for querying and updating the database.<ref>{{cite web |last=Ambler |first=Scott |title=Relational Databases 101: Looking at the Whole Picture |date=21 March 2023 |url=http://www.agiledata.org/essays/relationalDatabases.html }}{{better source needed|date=June 2018}}</ref>
 
==History==
The termconcept of ''relational database'' was first defined by [[Edgar F. Codd|E. F. Codd]] at [[IBM]] in 1970. Codd introduced the term ''relational'' in his research paper "A Relational Model of Data for Large Shared Data Banks".<ref name="codd" /> In this paper and later papers, he defined what he meant by ''relationalrelation''. One well-known definition of what constitutes a relational database system is composed of [[Codd's 12 rules]]. However, no commercial implementations of the relational model conform to all of Codd's rules,<ref>{{cite book |last=Date |first=Chris |title=Database in depth: relational theory for practitioners |date=5 May 2005 |publisher=O'Reilly |isbn=0-596-10012-4}}</ref> so the term has gradually come to describe a broader class of database systems, which at a minimum:
 
# Present the data to the user as [[relation (database)|relation]]s (a presentation in tabular form, i.e. as a ''collection'' of [[table (database)|tables]] with each table consisting of a set of [[Row (database)|rows]] and [[Column (database)|columns]]);
Line 25:
|isbn=978-3540483977
|quote=The product was called SQL/DS (Structured Query Language/Data Store) and ran under the DOS/VSE operating system environment}}</ref>
The first system sold as an RDBMS was [[Multics Relational Data Store]] (June 1976).{{cncitation needed|reason=Due to significance of nature of claim specific unambiguous cite is required at this point|date=August 2020}} [[Oracle Database|Oracle]] was released in 1979 by Relational Software, now [[Oracle Corporation]].<ref>{{cite journal |date=May 2007 |title=Oracle Timeline |journal=Profit Magazine |publisher=Oracle |volume=12 |issue=2 |page=26 |url=http://www.oracle.com/us/corporate/profit/p27anniv-timeline-151918.pdf |access-date=2013-05-16}}</ref> [[Ingres (database)|Ingres]] and [[IBM BS12]] followed. Other examples of an RDBMS include [[IBM Db2]], [[Adaptive Server Enterprise|SAP Sybase ASE]], and [[IBM Informix|Informix]]. In 1984, the first RDBMS for [[Macintosh 128K|Macintosh]] began being developed, code-named Silver Surfer, and was released in 1987 as [[4th Dimension (Software)|4th Dimension]] and known today as 4D.<ref>{{cite web |title=New Database Software Program Moves Macintosh Into The Big Leagues |website=tribunedigital-chicagotribune |date=28 June 1987 |url=httphttps://articleswww.chicagotribune.com/1987-/06-/28/business/8702170525_1_silvernew-surferdatabase-software-developersprogram-moves-macintosh-productsinto-the-big-leagues/ |access-date=2016-03-17}}</ref>
 
The first systems that were relatively faithful implementations of the relational model were from:
 
* University of Michigan – [[MICRO Relational Database Management System|Micro DBMS]] (1969)<ref name=ST_1>{{cite journal| title=A set theoretic data structure and retrieval language| author1=Hershey, W.R.| author2=Easthope, C.H.| url=https://dl.acm.org/doi/10.1145/1095495.1095500| publisher=[[Association for Computing Machinery]]| journal=ACM SIGIR Forum| volume=7| issue=4| pages=45-5545–55| date=1 December 1972| access-date=4 January 2024| doi=10.1145/1095495.1095500}}</ref>
* Massachusetts Institute of Technology (1971)<ref name=SIG_1>{{cite book| title=SIGFIDET '74: Proceedings of the 1974 ACM SIGFIDET (Now SIGMOD) Workshop on Data Description, Access and Control: Data Models: Data-Structure-Set versus Relational| url=https://dl.acm.org/doi/book/10.1145/800297| publisher=[[Association for Computing Machinery]]| date=1 January 1975| doi=10.1145/800297| access-date=4 January 2024| isbn=978-1-4503-7418-7}}</ref>
* IBM UK Scientific Centre at Peterlee – [[IBM IS1|IS1]] (1970–72),<ref name=PS_1>{{cite book| title=The Peterlee IS/1 System| author=Notley, M.G.| url=https://scholar.google.com/scholar?lookup=0&q=NOTLEY,+M.G.+The+Peterlee+IS/1+System,+I.B.M.+(U.K.)+Scientific+Centre+Report,+March+1972.+UKSC-0018.&hl=en&as_sdt=0,5| publisher=IBM United Kingdom Scientific Centre| date=1972| access-date=4 January 2024}}</ref> and its successor, [[PRTV]] (1973–79).<ref name="Todd 1976">{{cite journal|title=The Peterlee Relational Test Vehicle - A System Overview|journal=IBM Systems Journal|year=1976|first=Stephen|last=Todd|volume=15|issue=4|pages=285–308|doi=10.1147/sj.154.0285}}</ref>
 
Line 52:
Part of this processing involves consistently being able to select or modify one and only one row in a table. Therefore, most physical implementations have a unique [[primary key]] (PK) for each row in a table. When a new row is written to the table, a new unique value for the primary key is generated; this is the key that the system uses primarily for accessing the table. System performance is optimized for PKs. Other, more [[natural key]]s may also be identified and defined as [[alternate key]]s (AK). Often several columns are needed to form an AK (this is one reason why a single integer column is usually made the PK). Both PKs and AKs have the ability to uniquely identify a row within a table. Additional technology may be applied to ensure a unique ID across the world, a [[globally unique identifier]], when there are broader system requirements.
 
The primary keys within a database are used to define the relationships among the tables. When a PK migrates to another table, it becomes a foreign key (FK) in the other table. When each cell can contain only one value and the PK migrates into a regular entity table, this design pattern can represent either a [[One-to-one (data model)|one-to-one]] or [[One-to-many (data model)|one-to-many]] relationship. Most relational database designs resolve [[Many-to-many (data model)|many-to-many]] relationships by creating an additional table that contains the PKs from both of the other entity tables{{snd}} the relationship becomes an entity; the resolution table is then named appropriately and the two FKs are combined to form a PK. The migration of PKs to other tables is the second major reason why system-assigned integers are used normally as PKs; there is usually neither efficiency nor clarity in migrating a bunch of other types of columns.
 
===Relationships===
Relationships are a logical connection between different tables (entities), established on the basis of interaction among these tables. These relationships can be modelled as an [[Entity–relationship model|entity-relationship model]].
 
==Transactions==
Line 122:
{{Main|Unique key|Primary key}}
Every [[Relation (database)|relation]]/table has a primary key, this being a consequence of a relation being a [[Set (mathematics)|set]].{{Sfnp|Date|1984|p=268}} A primary key uniquely specifies a tuple within a table. While natural attributes (attributes used to describe the data being entered) are sometimes good primary keys, [[surrogate key]]s are often used instead. A surrogate key is an artificial attribute assigned to an object which uniquely identifies it (for instance, in a table of information about students at a school they might all be assigned a student ID in order to differentiate them). The surrogate key has no intrinsic (inherent) meaning, but rather is useful through its ability to uniquely identify a tuple.
Another common occurrence, especially in regard to N:M cardinality is the [[Compound key|composite key]]. A composite key is a key made up of two or more attributes within a table that (together) uniquely identify a record.<ref>{{citationCite book needed|datelast1=FebruaryConnolly 2020|first1=Thomas M |title=Database systems: a practical approach to design, implementation, and management |last2=Begg |first2=Carolyn E |publisher=Pearson |year=2015 |isbn=978-1-292-06118-4 |edition=global |location=Boston Columbus Indianapolis |pages=416}}</ref>
 
===Foreign key===
Line 159:
[[File:RDBMS structure.png|thumbnail|right|The general structure of a relational database]]
{{See also|Database#Database management system}}
Connolly and Begg define database management system (DBMS) as a "software system that enables users to define, create, maintain and control access to the database".<ref name="Begg-p64">{{cite book |last1=Connolly |first1=Thomas M. |last2=Begg |first2=Carolyn E. |date=2014 |title=Database Systems – A Practical Approach to Design Implementation and Management |edition=6th |publisher=Pearson |isbn=978-1292061184 |page=64}}</ref> RDBMS is an extension of that acronyminitialism that is sometimes used when the underlying database is relational.
 
An alternative definition for a ''relational database management system'' is a database management system (DBMS) based on the [[relational model]]. Most databases in widespread use today are based on this model.<ref>{{cite book |last1=Pratt |first1=Philip J. |last2=Last |first2=Mary Z. |date=2014-09-08 |title=Concepts of Database Management |edition=8 |publisher=Course Technology |isbn=9781285427102 |page=29 }}</ref>
 
RDBMSs have been a common option for the storage of information in databases used for financial records, manufacturing and logistical information, personnel data, and other applications since the 1980s. Relational databases have often replaced legacy [[hierarchical database]]s and [[network database]]s, because RDBMS were easier to implement and administer. Nonetheless, relational stored data received continued, unsuccessful challenges by [[object database]] management systems in the 1980s and 1990s, (which were introduced in an attempt to address the so-called [[object–relational impedance mismatch]] between relational databases and object-oriented application programs), as well as by [[XML database]] management systems in the 1990s.<ref>{{citationCite book |last=Feuerlich |first=George |url=https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=a61bad77f48d8438f47393c720292f5dc33a4c0d#page=169 |title=Dateso 10; Database Trends and Directions: Current Challenges and Opportunities needed|date=March21 2013April 2010 |publisher=MATFYZPRESS |year=2010 |isbn=978-80-7378-116-3 |edition=1st |location=Prague, Sokolovsk |pages=163–174}}</ref> However, due to the expanse of technologies, such as [[horizontal scaling]] of [[computer cluster]]s, [[NoSQL]] databases have recently become popular as an alternative to RDBMS databases.<ref>{{cite web |title=NoSQL databases eat into the relational database market |date=4 March 2015 |url=https://www.techrepublic.com/article/nosql-databases-eat-into-the-relational-database-market |access-date=2018-03-14}}</ref>
 
==Distributed relational databases==
Line 203:
==Sources==
*{{cite book |last=Date |first=C. J. |author-link=Christopher J. Date |date=1984 |title=A Guide to DB2 |edition=student |publisher=[[Addison-Wesley]] |isbn=0201113171 |ol=OL2838595M |oclc=256383726 |url=https://archive.org/details/guidetodb2users00date}}
 
 
 
{{Wikibooks |Structured Query Language}}