Unfazed❗️🎯

Relational Data Model 관계형 데이터 모델 본문

Database (데이터베이스)

Relational Data Model 관계형 데이터 모델

9taetae9 2023. 10. 21. 13:51
728x90

Relational Data Model

-introduced by E.F. Codd(1970)

-strong theoretical foundations

-very simple

-numerous commercial systems

-represents the database as a collection of relations and integrity constraints 데이터베이스 = 관계와 무결성 제약 조건의 형태

 

relation example 

ex) "student" relation with 5 tuples and 7 attributes

(= in network data model&hierarchical data model 5개의 record,rows 와 7개의 columns)

relation data model

 

Equlivalent terms

Relation data model Network data model & Hierarchical data model
relation table
tuple  record, row
attribute column

 

Attributes

-attributes has the domain, which is a set of all allowed values for that attribute

-attributes values are required to be atomic(indivisible)

-special value 'null' is a member of every domain(the null value causes complications in the definition of many relational operations)

 

All attributes are atomic in relational model (관계형 데이터 모델에서 attribute는 모두 원자성 특징을 가진다, 즉 분리 불가한 최소단위) ex) integer, real, char, varchar, decimal, date, time, timestamp, etc.

non-atomic attribute types ex) multi-valued attribute(set, bag(multiset), list), Composite attribute

 

Relation Schema and Instance

-let A1, A2, ..., An be attributes

-R = (A1, A2, ..., An) is a relation schema

-with a relation schema, we can have individual values (called a relation instance) for the schema

-given sets D1,D2,...,Dn(domains), a relation instace is a subset of D1x D2 x ... x Dn

-relation instance is a set of n-tuples (a1,a2, ..., an) (where ai가 Di의 원소일 경우에)

 

Relational Databases

-consist of a set of relations and a set of constraints

-Integrity constraints(Key, Entity, Referectial integrity, etc.)

 

Order is immarterial(not important)

-relations are unordered

-order of tuples is irrelevant(tuple may be stored in an arbitary order)

 

Keys

-Let K ⊂ R

-K is a superkey of R, if values for K are sufficient to identify a unique tuple of each possible relation

-Superkey K is a candidate key if K is minimal

-One of the candidate keys is selected to be the primary key(only one primary key can exist for each table)

 

Key example 

MyStudent(student-id, name, national-id,address,phone)

-The student-id is unique among students, the national-id is unique among all people

SuperKey (개체를 식별할 수 있기만 하면 모두 SuperKey가 된다/ 즉, 해당키를 기준으로 1개 이하의 개체들로 분류가능하면 된다)

-(stduent-id),(student-id,name), (student-id, name, address)

-(national-id),(national-id,name),(national-id,address,phone)

-(student-id,national-id),(student-id,national-id,name),(student-id, national-id,address,phone),...

Candidate key (후보키) // Superkey들 중 가장 요소 적은 것

-(student-id)

-(national-id)

Primary Key (one of the candidate keys)// 후보키 중 하나

-one of (student-id) or (national-id)

 

Referential Integrity Constraint

-referential constraint is unique in relational data model, where the data association is implemented by using "values"(not by pointers)  (referential integrity constrains require every value in one relation to appear in another relation)

 

 

Data Dictionary

-the data dictionary(also called system catalog) stores metadata such as 

-names of relations, names, types and lengths of attributes of each relation, name and definitions of views, integrity constraints, user and accounting information, including passwords, statistical and descriptive data(number of tuples in each relation), physical file organization information(how relation is stored(sequential/hash/..),physical location of relation),information about indices

 

728x90