데이터베이스설계

[데이터베이스설계] 2-8 rename, 동일한 쿼리들

젼젼39 2024. 11. 17. 18:11
Rename
operation
ρ
개명
Rename operation 개명 => ρ X(A1, A2, … An) (릴레이션R)   // ρ X (릴레이션R), ρ X(A1, A2, … An) (릴레이션R)
-      관계 대수식의 결과에는 이를 참조하는 데 사용할 수 있는 이름이 없음그래서 이걸 씀
-      ρ X (임의의 관계대수 연산으로 형성된합집합, PROJECT, SELECT 있을 수 있음..) 이걸 x
카티션 곱을 할 때, 경우에 따라 같은 relation을 곱하면 이름 중복되니까 둘 중 하나 개명
동일한
쿼리들
Q) find information in the Physics department with salary greater than 90,000
   => σ dept=”Physics” ^ salary > 90,000 (instructor)
   => σ dept_name=”Physics” ( σ salary > 90,000 (instructor))
 
Q) find information about courses taught by instructors in the Physics department
   => σ dept_name=”Physics” (instructor instructor.ID = teaches.ID teaches)   //instructor, teaches 조인후 select
   => ( σ dept_name=”Physics” (instructor) ) instructor.ID = teaches.ID teaches
 
두 쿼리는 동일하지는 않지만(not identical); 동등하다(equivalent) – 모든 데이터베이스에서 동일결과
 
테이블이라는 자료구조에 들어있는 데이터 중 원하는 걸 검색하기 위해 관계대수연산자 사용
그 관계대수연산자 하나만으로 원하는 내용 뽑아낼 수 없어서 관계대수식이 생김
      -> relation에 대해 연산해서 relation을 얻게 됨