전자적으로(electronically) 저장되고 사용되는 관련있는(related) 데이터들의 조직화된 집합
data models 분류
- conceptual (or high-level) data models
일반사용자들이 쉽게 이해할 수 있는 개념들로 이루어진 모델
추상화 수준이 가장 높음
비즈니스 요구 사항을 추상화하여 기술할 때 사용 (대표적 예: entity-relationship model)
- logical (or representational) data models
이해하기 어렵지 않으면서도 디테일하게 DB를 구조화 할 수 있는 개념들을 제공
데이터가 컴퓨터에 저장될 때의 구조와 크게 다르지않게 DB 구조화를 가능하게 함
특정 DBMS나 storage에 종속되지않는 수준에서 DB를 구조화 할 수 있는 모델
(예: relational data model)
logical (or representational) data models 종류
- relational data model
- object data model
- object-relational data model
- physical (or row-level) data models
컴퓨터에 데이터가 어떻게 파일형태로 저장되는지를 기술할 수 있는 수단을 제공
data format, data orderings, acess path 등등
acess path : 데이터 검색을 빠르게 하기 위한 구조체 (e.g. index)





relational data model
set
서로다른 elements를 가지는 collocetion
하나의 set에서 elements의 순서는 중요하지않다.
- e.g.{1,3,11,4,7}
수학에서 relation이 무엇을 의미하는가?
tuple : 몇개의 element로 이루어진 리스트
relation in mathematics
- subset of Cartesian product
- set of tuples
relational data model
set = domain
domain : element(=value) 값들의 집합
relation schema
- relation의 구조를 나타낸다.
- relation 이름과 attributes리스트로 표기된다.
- e.g. STUDENT(id name, grade, major, phone_num, emer_phone_num)
- attributes와 관련된 constraints도 포함한다.

degree of a relation
- relation schema에서 attributes의 수
- e.g. STUDENT(id, name, grade, major, phon_num, emer_phone_num) -> degree6
relation (or relation state)
- set of tuples
relational database
-relation data model에 기반하여 구조화된 database
-relation database는 여러개의 relations로 구성된다.
relational database schema
relation schemas set + integrity constraints set
relation 특징
1. relation은 중복된 tuple을 가질 수 없다. (relation is set of tuples)
2. relation의 tuple을 식별하기 위해 attribute의 부분 집합을 key로 설정한다.
3. relation에서 tuple의 순서는 중요하지않다.
4. 하나의 relation에서 attribute의 이름은 중복되면 안된다.
5. 하나의 tuple에서 attribute의 순서는 중요하지않다.
6. attribute는 atomic해야한다.(composite or multivalued attribute 허용 안됨)
NULL
- 값이 존재하지 않는다.
- 값이 존재하나 아직 그 값이 무엇인지 알지 못한다.
- 해당 사항과 관련이 없다.
KEY
1. superkey
- relation에서 tuples를 unique하게 식별할 수 있는 attributes set
- e.g.PLAYER(id, name, team_id, back_number, birth_date)의 superkey는
{id, name, team_id, back_number, birth_date}, {id,name},{name, team_id, back_number}, ... etc
2. candidate key
- 어느 한 attribute라도 제거하면 unique하게 tuple를 식별할 수 없는 super key
- key or minimal superkey
- e.g. PLAYER(id, name, team_id, back_number,barth_date)의 candidate key는
{id}, {team_id, back_number}
3. primary key
- relation에서 tuples를 unique하게 식별하기위해 선택된 candidate key
- e.g. PLAYER(id, name, team_id, back_number, birth_date)의 primary key는
{id} or {team_id, back_number}
4. unique key (=alternate key)
- primary key가 아닌 candidate keys
- e.g. PLAYER(id, name, team_id, back_number, birth_date)의 unique key는
{team_id, back_number}
5. foreign key
- 다른 relation의 PK를 참조하는 attributes set
- e.g.PLAYER(id,name,team_id,back_number,birth_date)와 TEAM(id,name,manager)가 있을 때
foreign key는 PLAYER의 {team_id}
constraints
relational database의 relations들이 언제나 항상 지켜줘야 하는 제약 사항
implicit constraints
- relational data model 자체가 가지는 constraints
- relation은 중복되는 tuple을 가질 수 없다.
- realation 내에서는 같은 이름의 attribute를 가질 수 없다.
schema-base constraints
- 주로 DDL을 통해 schema에 직접 명시할 수 있는 constraints
- explicit constraints
domain constraints
- attribute의 value는 해당 attribute의 domain에 속한 value여야 한다.
key constraints
- 서로 다른 tuples는 같은 value의 key를 가질 수 없다.
NULL value constraint
- attribute가 NOT NULL로 명시됐다면 NULL을 값으로 가질 수 없다.
entity integrity constraint
- primary key는 value에 NULL을 가질 수 없다.
referential integrity constraint
- FK와 PK와 도메인이 같아야 하고 PK에 없는 values를 FK가 값으로 가질 수 없다.
'컴퓨터 > DB' 카테고리의 다른 글
| ch04. 데이터 모델링 (0) | 2024.04.18 |
|---|---|
| ch01_ch02. 데이터베이스 기본개념_데이터베이스 관리 시스템 (0) | 2024.04.08 |
| CH03. 데이터베이스 시스템 (1) | 2024.03.25 |