본문 바로가기

데이터베이스설계33

[데이터베이스설계] 2-6 합집합, 교집합 Union operation ∪ 합집합 Union operation => 릴레이션R ∪ 릴레이션S= 2개의 relation(투플의 집합)들을 결합…     //중복 제거됨 * r, s가 합집합 연산이 되기 위해 만족해야 하는 조건 [유니온 호환성 union compatibility](1) r, s는 동일한 arity(컬럼의 수)을 가져야 한다(2) 속성 도메인(해당컬럼에 등장가능한 값의 집합=컬럼데이터타입)이 compatible(호환)되어야 함.    (예: r의 두번째 column은 s의 두번째 column과 같은 타입이어야 함) Q) find all courses id taught in the Fall 2017 semester, or in the Spring 2018 semester. Or in bo.. 2024. 11. 15.
[데이터베이스설계] 2-5 Cartesian, Join operation Cartesian카티션 곱 => 릴레이션R X 릴레이션S- 카티션 곱 연산을 사용하면 두 relation의 정보를 결합할 수 있음 (결과도 relation)- 겹치는 attribute는 그 앞에 원래 relation의 이름을 붙여 구분함      -> instructor.ID, teaches.ID 집합 r, s가           // (1, a) à binary tuples | (g, h, i) -> ternary tuple | (1, x, g, h, i) -> 5-tupler = { 1, 2, 3, 4 } 이고 s = { a, b, c } 라면 r x s = { (1, a), (1, b), …  }         12개의 binary tuplesr = { (1, x), (2, y) } 이고 s = {.. 2024. 11. 14.
[데이터베이스설계] 2-4 Select, Project SELECTσ 시그마SELECT 연산 => σ 조건 (Relation) //시그마 p의 r                                    [where 부분]    = 주어진 조건(predicate)를 만족하는 튜플을 선택, relation으로 반환Q) select those tuples of the instructor relation where the instructor is in the “Physics” department    => σ dept_name = “Physics” (instructor)-      비교연산자 (comparisons) 사용 가능==> 컬럼 이름 (=, =/=, >, >=, 이렇게도 가능-      Connectives를 이용해 여러 조건들을 결합해 사용 가능=.. 2024. 11. 13.