본문 바로가기
데이터베이스설계

[데이터베이스설계] 3-2 where절, from절

by 젼젼39 2024. 11. 21.
where절 WhereSELECTION σ 와 같은 역할 함, 만족해야 하는 조건을 나타냄
 
where에는 and, or, not 사용해 연결 가능
where에는 비교 연산자들(<, <=, >, >=, =, <>) 사용 가능
from절 From은 카티션 곱 X 과 같음, 쿼리에 포함할 relation들을 열거함.
여러 relation이면 모두 짝짓기, 같은 컬럼명은 앞에 relation 이름을 붙인다
 

Q) find names of all instructors in the Art department who have taught some course and the course_id
=> select name, course_id
    from instructor, teaches
    where instructor.ID = teaches.ID and instructor.dept_name = ‘Art’
                                     //굳이 instructor 안붙여도 dept_name은 여기밖에 없음