반응형
[본글은 고려대학교 정보대학 정순영 교수님 COSE 371 데이터베이스 수강중 중간고사 정리를 위해 작성하는 글임을 밝힙니다.]
Intro
Entitiy, Instance,Schema 용어 정리
Schema: logical Structure of a Database
- StudentID: 학생 고유의 식별 번호 (예: char(8))
- Name: 학생의 이름 (예: varchar(100))
- Major: 전공 (예: varchar(100))
- EnrollmentDate: 등록 날짜 (예: date)
Entitiy: An entity is an object that exists.
Major entity에는 Physics,Math,English가 있다와 같이 쓰인다
Instance: the actual content of the database
'학생' 테이블에 '20201234'라는 StudentID를 가진 'Jane Doe'라는 이름의 학생은 특정 학생 엔티티의 인스턴스
Database Design Process
- Conceptual Design을 통해 추상적인 디자인을 한다. 이때 entity 등 간의 relation인 E-R을 통한 모델링을 한다.
- Logical Design을 통해 Relational Modeling 및 Relational DB Design을 한다.
- 이후 실제로 physical design을 하여 database design을 완료한다.
Data Dictionary
- 말 그대로 data에 대한 dictionary로 data 대한 data인 metadata를 갖고 있다. 크게 세 가지 항목을 갖고 있다.
- Database schema
- Integrity Constraints(완전성을 위한 제약 조건)
- Authorization
Relational Model
- Based on Set theory and Predicate Logic
- Set theory: 중복되면 하나만 카운트 하며, 순서가 의미가 없다
- Predicate logic: First argument가 주로 subject(대상)이며,second가 genitive or possessive(소유격)이다.
- Basic Structure: set D1,D2,D3가 주어졌을 때 relation r은 subset of D1xD2x...Dn이며, 모든 tuple들은 Unique하다
- Order of tuple, Order of Attribute는 의미가 없다.
Key
- SuperKey: K is a super key of R if values for K are sufficient to identify a unique tuple of each possible relation r(R)
- {ID},{ID,name} 등이 superkey가 될 수 있다.
- Candidate Key: SuperKey K is a candidate key if K is minimal
- {ID}는 candidate key가 될 수 있지만, {ID,name}은 candidate key가 될 수는 없다.
- Primary Key: One of the key is selected to be primary key
Relational Database(Integrity constraints)
- Entity integrity: No primary key value can be null
- Referential integrity: 두 개의 relation에서 하나의 튜플이 다른 relation의 튜플을 참조할 때 existing tuple을 참조해야함
- Domain Integrity: Every element form a relation should respect the type and restrictions of corresponding attribute
- User Defined Integrity: User가 정의하는 integrity
Relational Algebra
Select Operation: operator to select rows satisfying the given condition
Project Operation: operation to project attributes
- duplicate rows are removed from result because relations are sets
Cartesian Product Operation:
r x s 를 실행함.
Natural-Join Operation: 교집합을 중심으로 새로운 결과를 도출함.
Union Operation: r U S
- r,s must have the same arity (same number of attributes)
- attribute domain must be compatible
Interaction Operation : r & S
- Union Operation과 같은 조건이 있어야 가능함.
Set Difference Operation
- r - s
반응형
'DataBase' 카테고리의 다른 글
[데이터베이스] SQL 개념 정리 (1) | 2024.06.04 |
---|---|
[데이터베이스] 주요 개념 정리2 (0) | 2024.04.11 |