domain : 더이상 나누어 지지 않는 값들의 집합
domain name : domain 이름
relation : 튜플들의 집합 ex)열들이 모인 테이블
tuple : 각 attribute의 값으로 이루어진 리스트 ex)한 열
attribute : domain이 relation에서 맡은 역할 ex) 컬럼
relation schema
- relation 이름과 attributes 리스트로 표기된다
- ex) STUDENT(id, name, grade)
degree of a relation
- relation schema에서 attributes의 수
- ex) STUDENT(id, name, grade) -> degree 6
relation database
- relational data model에 기반하여 구조화된 database
relation 특징
- 중복된 tuple을 가질 수 없다
- tuple을 식별하기 위해 attributes의 부분 집합을 key로 설정한다
id를 key로 사용하여 각 튜플을 유니크하게 구분할 수 있다
- tuple의 순서는 중요하지 않다
- 하나의 relation에서 attribute의 이름은 중복되면 안된다
- attribute 순서는 중요하지 않다
- attribute는 atomic 해야 한다 ex)서울시 강남구 청담동이나 컴공, 디자인을 나눠서 저장해야한다
PLAYER(id,name,team_id,back_number,birth_date) table이 있다
superkey
- relation에서 tuples를 unique하게 식별할 수 있는 attributes set
candidate key
- 어느 한 attribute라도 제거하면 unique하게 tuples를 식별할 수 없는 super key
- {id}, {team_id,back_number}
primary key
- relation에서 tuples를 unique하게 식별하기 위해 선택된 candidate key
- {id} or {team_id,back_number}
- 주로 attributes가 적은 걸로 고른다
unique key(alternate key)
- primary key가 아닌 candidate keys
- id가 primary key이면 unique key는 team_id,back_number
foreign key
- 다른 relation의 PK를 참조하는 attributes set
- PLAYER(id,name,team_id,back_number,birth_date)와 TEAM(id,name,manager)가 있을 때 PLAYER의 foreign key는 {team_id}
constraints
- relational database의 relations들이 언제나 지켜줘야 하는 제약 사항
자료출처
유튜브, 쉬운코드
'CS(Computer Science) > 데이터베이스' 카테고리의 다른 글
[데이터베이스] 역정규화란 무엇인가? (0) | 2023.05.25 |
---|---|
[데이터베이스] MySQL(관계형 데이터베이스) (0) | 2023.05.10 |
[데이터베이스] 정보관리도구의 발전 (0) | 2023.05.09 |
[데이터베이스] 데이터베이스 기본 개념 (0) | 2023.04.03 |
[데이터베이스] 데이터베이스 정규화 (0) | 2023.02.09 |
댓글