Cardinality (data modeling)

Within data modelling, cardinality is the numerical relationship between rows of one table and rows in another. Common cardinalities include one-to-one, one-to-many, and many-to-many. Cardinality can be used to define data models as well as analyze entities within datasets.

Relationships

For example, consider a database of electronic health records. Such a database could contain tables like the following:

  • A doctor table with information about physicians.
  • A patient table for medical subjects undergoing treatment.
  • An appointment table with an entry for each hospital visit.

Natural relationships exist between these entities:

  • A many-to-many relationship between records in doctor and records in patient because doctors have many patients and patients can see many doctors.
  • A one-to-many relationship between records in patient and records in appointment because patients can have many appointments and each appointment involves only one patient.[1]
  • A one-to-one relationship is mostly used to split a table in two in order to provide information concisely and make it more understandable. In the hospital example, such a relationship could be used to keep apart doctors' own unique professional information from administrative details.[citation needed]

Modeling

In data modeling, collections of data elements are grouped into "data tables" which contain groups of data field names called "database attributes". Tables are linked by "key fields". A "primary key" assigns a field to its "special order table". For example, the "Doctor Last Name" field might be assigned as a primary key of the Doctor table with all people having same last name organized alphabetically according to the first three letters of their first name. A table can also have a foreign key which indicates that field is linked to the primary key of another table.[2]

Types of models

A complex data model can involve hundreds of related tables. Computer scientist Edgar F. Codd created a systematic method to decompose and organize relational databases.[3] Codd's steps for organizing database tables and their keys is called database normalization, which avoids certain hidden database design errors (delete anomalies or update anomalies). In real life the process of database normalization ends up breaking tables into a larger number of smaller tables.[3]

Two related entities shown using Crow's Foot notation. In this example, the three lines next to the song entity indicate that an artist can have many songs. The two vertical lines next to the artist entity indicate songs can only have one performer.

In the real world, data modeling is critical because as the data grows voluminous, tables linked by keys must be used to speed up programmed retrieval of data. If a data model is poorly crafted, even a computer applications system with just a million records will give the end-users unacceptable response time delays. For this reason, data modeling is a keystone in the skills needed by a modern software developer.[citation needed]

Database modeling techniques

The entity–relationship model proposes a technique that produces entity–relationship diagrams (ERDs), which can be employed to capture information about data model entity types, relationships and cardinality. A Crow's foot shows a one-to-many relationship. Alternatively a single line represents a one-to-one relationship.[4]

Application program modeling approaches

In the object-oriented application programming paradigm, which is related to database structure design, UML class diagrams may be used for object modeling. In that case, object relationships are modeled using UML associations, and multiplicity is used on those associations to denote cardinality. Here are some examples:[5]

Relationship Example Left Right Narrative
One-to-one person ←→ birth certificate 1 1 A person must have their own birth certificate, it is specific to that person by its Id number.
One-to-one (optional on one side) person ←→ driving license 1 0..1 or ? A person may have a driving license, it is specific to that person by its Id number.
One-to-many order ←→ line item 1 1..* or + An order contains at least one item
Many-to-one person ←→ birthplace 1..* or + 1 Many people can be born in the same place, but 1 person can only be born in 1 birthplace
Many-to-many course ←→ student 1..* or + 1..* or + Students follow various courses
Many-to-many (optional on both sides) person ←→ book 0..* or * 0..* or * A person may own many books(copies), and a book may be owned by many people(readers).

See also

References

  1. ^ Clarke, Alex; Hasnani, Aleen; Al-Ahasan, Abdullah; Islam, Nazmul (7 September 2022). "Data Modeling and Entity Relationship Diagram (ERD)". University of Regina - Computer Science Department.
  2. ^ "Entity Relationship Mapping". Oracle Corporation. Retrieved 1 August 2002.
  3. ^ a b Codd, E. F. (1990). The relational model for database management : version 2. Reading, Mass.: Addison-Wesley. ISBN 0-201-14192-2. OCLC 19590880.
  4. ^ "Crow's Foot Notation". University of Regina.
  5. ^ "Cardinality". datacadamia. 7 September 2022.

Read other articles:

Untuk Yeremia 33 dalam Septuaginta, lihat Yeremia 26. Yeremia 33Kitab Yeremia dalam Alkitab Ibrani, MS Sassoon 1053, foto 283-315.KitabKitab YeremiaKategoriNevi'imBagian Alkitab KristenPerjanjian LamaUrutan dalamKitab Kristen24← pasal 32 pasal 34 → Yeremia 33 (disingkat Yer 33; Penomoran Septuaginta: Yeremia 40) adalah bagian dari Kitab Yeremia dalam Alkitab Ibrani dan Perjanjian Lama di Alkitab Kristen. Berisi perkataan nabi Yeremia bin Hilkia, tentang Yehuda dan Yerusalem, yang ...

 

Si ce bandeau n'est plus pertinent, retirez-le. Cliquez ici pour en savoir plus. Le contenu de cet article ou de cette section est peut-être sujet à caution et doit absolument être sourcé (août 2013). Si vous connaissez le sujet dont traite l'article, merci de le reprendre à partir de sources pertinentes en utilisant notamment les notes de fin de page. Vous pouvez également laisser un mot d'explication en page de discussion. Cet article est une ébauche concernant un terme géographiqu...

 

Korean Air Penerbangan 801Ringkasan peristiwaTanggal6 Agustus 1997RingkasanMenabrak gunung disebabkan adanya malfungsi Glideslope disertai cuaca hujan yang derasLokasiBandar Udara Internasional Antonio B. Won Pat , GuamPenumpang237Awak17Cedera26Tewas229Selamat25Jenis pesawatBoeing 747-3B5OperatorKorean Air Korean Air Penerbangan 801 (KE801, KAL801) merupakan penerbangan penumpang berjadwal yang dioperasikan oleh Korean Air yang jatuh pada tanggal 6 Agustus 1997 di Bandar Udara Internasio...

Species of vesper bat Rohu's bat Conservation status Least Concern  (IUCN 3.1)[1] Scientific classification Domain: Eukaryota Kingdom: Animalia Phylum: Chordata Class: Mammalia Order: Chiroptera Family: Vespertilionidae Genus: PhiletorThomas, 1902 Species: P. brachypterus Binomial name Philetor brachypterus(Temminck, 1840) Rohu's bat (Philetor brachypterus) is a species of vesper bat. It is the only species in the genus Philetor. It is found in Brunei, Indonesia, Malaysia, N...

 

Human settlement in EnglandMuch HooleSt Michael's Parish ChurchMuch HooleShown within South RibbleShow map of the Borough of South RibbleMuch HooleLocation within LancashireShow map of LancashirePopulation1,997 [1]OS grid referenceSD471232Civil parishMuch HooleDistrictSouth RibbleShire countyLancashireRegionNorth WestCountryEnglandSovereign stateUnited KingdomPost townPRESTONPostcode districtPR4Dialling code01772PoliceLancashireFireLancashireAmbulan...

 

Valeria Marini nel 2014 Valeria Virginia Laura Marini (Roma, 14 maggio 1967) è una soubrette, attrice e imprenditrice italiana. Ha raggiunto il successo nei primi anni novanta grazie alla sua partecipazione come primadonna a diversi varietà del Bagaglino, rimanendovi per più stagioni e tornandovi nel corso degli anni successivi, dopo l'affermazione come attrice in spettacoli teatrali, pellicole cinematografiche e televisive. Nel corso della sua carriera ha anche lavorato come conduttrice d...

American UFO commentator (1931–2012) James Moseley and Jim Moseley redirect here. For the South Australian politician, see James Moseley (politician). James W. MoseleyJames Moseley at the 1980 National UFO Conference in New YorkBornJames Willett Moseley(1931-08-04)August 4, 1931New YorkDiedNovember 16, 2012(2012-11-16) (aged 81)Key West, FloridaNationalityAmericanCitizenshipUnited States of AmericaKnown forNewsletter Saucer SmearScientific careerFieldsUFOlogist James Willett Mosel...

 

Speech by US president Bill Clinton 1994 State of the Union AddressFull video of the speech as published by the White HouseDateJanuary 25, 1994 (1994-01-25)Time9:00 p.m. ESTDuration1 hour, 3 minutesVenueHouse Chamber, United States CapitolLocationWashington, D.C.Coordinates38°53′23″N 77°00′32″W / 38.88972°N 77.00889°W / 38.88972; -77.00889TypeState of the Union AddressParticipantsBill ClintonAl GoreTom FoleyPrevious1993 Joint session spe...

 

Municipality in Catalonia, SpainPoboledaMunicipalityPoboleda Coat of armsPoboledaLocation in CataloniaCoordinates: 41°14′N 0°51′E / 41.233°N 0.850°E / 41.233; 0.850Country SpainCommunity CataloniaProvince TarragonaComarcaPrioratGovernment • MayorJordi Català Jasan (2015)[1]Area[2] • Total14.0 km2 (5.4 sq mi)Population (2018)[3] • Total335 • Density24/km2 ...

45th United States presidential inauguration Second presidential inauguration of Lyndon B. JohnsonDateJanuary 20, 1965; 59 years ago (1965-01-20)LocationUnited States Capitol,Washington, D.C.Organized byJoint Congressional Committee on Inaugural CeremoniesParticipantsLyndon B. Johnson36th president of the United States— Assuming officeEarl WarrenChief Justice of the United States— Administering oathHubert Humphrey38th vice president of the United States— Assuming offic...

 

この記事は検証可能な参考文献や出典が全く示されていないか、不十分です。出典を追加して記事の信頼性向上にご協力ください。(このテンプレートの使い方)出典検索?: コルク – ニュース · 書籍 · スカラー · CiNii · J-STAGE · NDL · dlib.jp · ジャパンサーチ · TWL(2017年4月) コルクを打ち抜いて作った瓶の栓 コルク(木栓、�...

 

Флаг гордости бисексуалов Бисексуальность      Сексуальные ориентации Бисексуальность Пансексуальность Полисексуальность Моносексуальность Сексуальные идентичности Би-любопытство Гетерогибкость и гомогибкость Сексуальная текучесть Исследования Шк...

Suzaka 須坂市Kota BenderaLambangLocation of Suzaka in Nagano PrefectureNegara JepangWilayahChūbuPrefekturNaganoPemerintahan • WalikotaMasao MikiLuas • Total149,67 km2 (5,779 sq mi)Populasi (Januari 1, 2020) • Total49.616 • Kepadatan332/km2 (860/sq mi)Zona waktuUTC+9 (Japan Standard Time)Simbol kota • Pohonクマスギ• BungaRhododendron molleNomor telepon0268-62-1111AlamatSuzaka 1528-1, Suzaka-shi,...

 

Acts of genocide committed against Native Americans in the United States Native American genocide in the United States1919 illustration of a U.S. cavalry attack on a villageLocationUnited StatesTargetNative AmericansAttack typeGenocide, mass murder, forced displacement, ethnic cleansing, collective punishment, starvation, othersDeaths 96% population drop (1492–1900)[a] +4 million (est. 1492-1776)[3] 350,000 (58% population decline from 1800 to 1890)[4] Victims 98% lo...

 

此條目缺少有關频率 (统计学)的信息。 (2024年5月29日)請擴充此條目相關信息。討論頁可能有詳細細節。 三個閃動的光圓,從最低頻率(上端)至最高頻率(下端)。 频率(frequency)又稱週率,是物理学上描述某具规律週期性的现象或事件,在每单位时间内(即每秒)重复发生的次数(週期數,即循环次数);通常以符号 f {\displaystyle f} 或 ν {\displaystyle \nu } 表示。频率�...

  提示:此条目页的主题不是逆反票。 此條目需要补充更多来源。 (2022年10月27日)请协助補充多方面可靠来源以改善这篇条目,无法查证的内容可能會因為异议提出而被移除。致使用者:请搜索一下条目的标题(来源搜索:废票 — 网页、新闻、书籍、学术、图像),以检查网络上是否存在该主题的更多可靠来源(判定指引)。 此條目可能包含原创研究。请协助補�...

 

2017 Canadian drama film Kayak to KlemtuFilm posterDirected byZoe Leigh HopkinsWritten byZoe Leigh HopkinsScooter CorkleMichael SparagaProduced byDaniel BekermanStarringTa'Kaiya BlaneySonja BennettEvan AdamsCinematographyVince ArvidsonEdited bySimone SmithMusic byOleksa LozowchukProductioncompanyScythia FilmsDistributed byMongrel MediaRelease date October 20, 2017 (2017-10-20) (imagineNATIVE) Running time90 minutesCountryCanadaLanguageEnglish Kayak to Klemtu is a Canadian d...

 

此條目需要补充更多来源。 (2021年5月22日)请协助補充多方面可靠来源以改善这篇条目,无法查证的内容可能會因為异议提出而被移除。致使用者:请搜索一下条目的标题(来源搜索:普吉府 — 网页、新闻、书籍、学术、图像),以检查网络上是否存在该主题的更多可靠来源(判定指引)。 普吉府ภูเก็ต府 圖章普吉府在泰國的位置坐标:7°53′24″N 98°23′54″Eþ...

  提示:此条目页的主题不是查理二世。   关于与「理查二世」標題相近或相同的条目页,請見「理查二世 (消歧義)」。 理查二世Richard II理查二世加冕肖像(威斯敏斯特大教堂)英格蘭君主統治1377年6月21日-1399年9月30日加冕1377年7月16日前任愛德華三世繼任亨利四世摄政岡特的約翰出生(1367-01-06)1367年1月6日波爾多阿基坦公爵領地逝世1400年2月14日(1400歲—02—14)�...

 

Ceremonial designation of church buildings For a list of all the Catholic basilicas in the world, see List of Catholic basilicas. Floorplan of San Lorenzo in Damaso, a basilica in Rome. It is built in the basilica style: a rectangular building with a nave flanked by longitudinal aisles. Basilicas are Catholic church buildings that have a designation, conferring special privileges, given by the Pope. Basilicas are distinguished for ceremonial purposes from other churches. The building need not...