Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 2: Intro to Relational Model

Similar presentations


Presentation on theme: "Chapter 2: Intro to Relational Model"— Presentation transcript:

1 Chapter 2: Intro to Relational Model

2 Example of a Relation 속성 attributes (or columns) 튜플 tuples (or rows)

3 속성 타입 (attribute types)
속성 값으로 허용 되는 값의 집합을 속성의 도메인(domain) 이라고 부른다. 속성 값은 일반적으로 원자값 (atomic value; that is, indivisible)의 성질을 만족하여야 한다. 널(null) 값은 모든 도메인에 포함된다고 가정한다. 그러나 널 값은 많은 연산 정의에 혼란을 야기 시킬 수 있다.

4 릴레이션 스키마와 인스탄스 (Relation Schema and Instance)
A1, A2, …, An : 속성 R = (A1, A2, …, An ) : 릴레이션 스키마 Example: instructor = (ID, name, dept_name, salary) 집합 D1, D2, …. Dn 이 주어자면 릴레이션 r 은 D1 x D2 x … x Dn 의 부분 집합이다. 따라서, 릴레이션은 aiDi인 n-튜플(a1, a2, …, an)의 집합이다. 릴레이션의 현재 값들 (relation instance) 은 테이블 형태로 표현된다. r 의 원소 t 는 테이블의 행(row )으로 표현된다.

5 Relations are Unordered
튜플들의 순서에는 의미가 없다. 즉, 튜플은 임의의 순서로 저장될 수 있다. Example: instructor relation with unordered tuples

6 Database 데이터베이스는 다수의 릴레이션으로 구성된다. 전체 DB 정보는 다음과 같이 부분으로 나뉘어진다
instructor student advisor 잘못된 설계 예: univ (instructor -ID, name, dept_name, salary, student_Id, ..) 파급되는 결과 정보의 중보 기입 (e.g., two students have the same instructor) 널값 생성 (e.g., represent an student with no advisor) 정규화 이론 (Chapter 7)에서 좋은 릴레이션 스키마 설계법에 대하여 학습함.

7 키 (Key) K  R 이라고 가정. K의 값이 각각의 가능한 릴레이션 r(R)의 고유한 튜플을 구분하는데 충분하다면 K는 R의 수퍼 키이다. “가능한 r”이란 모델링하고 있는 조직에 존재할 수 있는 릴레이션 r을 의미한다. Example: {ID} and {ID,name} are both superkeys of instructor. 수퍼 키 K가 최소의 조건을 만족시키면 후보 키이다. Example: {ID} is a candidate key for Instructor 후보 키 중 하나가 주키(primary key)로 선택된다. which one? 외래 키 제약조건 (Foreign key constraint): 하나의 릴레이션 내 속성 값이 다른 릴레이션에 존재하여야 한다. Referencing relation Referenced relation

8 Schema Diagram for University Database

9 질의어 (Relational Query Languages)
사용자가 데이터베이스로부터 정보를 요청하는 언어 언어의 부류: - 절차식 - 비절차식 순수언어: - 관계형 대수 - 튜플 관계형 해석 - 도메인 관계형 해석 순수 언어는 사람들이 사용하는 질의어의 기본을 이루고 있다.

10 선택연산 (Selection of tuples)
Relation r Select tuples with A=B and D > 5 σ A=B and D > 5 (r)

11 추출 연산 (Selection of Columns)
Relation r: Select A and C Projection Π A, C (r)

12 두 릴레이션의 조인 - 카티션 곱 Relations r, s: r x s:

13 합집합 (Union of two relations)
Relations r, s: r  s:

14 차집합 (Set difference of two relations)
Relations r, s: r – s:

15 공통 집합 (Set Intersection of two relations)
Relation r, s: r  s

16 자연 조인 예제 (Natural Join Example)
Relations r, s: Natural Join r s

17 Figure in-2.1

18 End of Chapter 2

19 Figure 2.01

20 Figure 2.02

21 Figure 2.03

22 Figure 2.04

23 Figure 2.05

24 Figure 2.06

25 Figure 2.07

26 Figure 2.10

27 Figure 2.11

28 Figure 2.12

29 Figure 2.13


Download ppt "Chapter 2: Intro to Relational Model"

Similar presentations


Ads by Google