일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- 플로이드워셜
- 오류검출
- 티스토리챌린지
- 오류제어
- 오블완
- 주기신호
- tcp 세그먼트
- well known 포트
- 토큰 버스
- git merge
- 항해99
- 프레임 구조
- 99클럽
- 비주기신호
- 데이터 전송
- 우분투db
- 그리디 알고리즘
- 순서번호
- reducible
- IEEE 802
- tcp 프로토콜
- 개발자취업
- til
- 코딩테스트준비
- mariadb
- i-type
- 스레드
- leetcode
- 서비스 프리미티브
- xv6
- Today
- Total
Unfazed❗️🎯
Relational Data Model 관계형 데이터 모델 본문
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