Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- value
- class
- methodArea
- concreteclass
- override
- super
- 객체형변환
- run()
- Eureka
- hashCode
- arguments
- hamobee
- overload
- constantnumber
- Vector
- ALTER
- 추상클래스
- MSA
- reference
- fuction
- abstractclass
- Polymorphism
- garbagecollection
- eclipse
- 콘크리트클래스
- start()
- string
- 생성자
- object
- Hashtable
Archives
- Today
- Total
뇌운동일지
[Oracle] SubQuery, 집합연산자 본문
SubQuery
1. 쿼리문 안의 쿼리문
2. 반드시 ( ) 로 감싼다
3. 서브쿼리부터 동작 / 서브쿼리만으로도 실행된다
4. 서브쿼리의 결과 -> 바깥쿼리의 인자로 사용
5. 서브쿼리 -> 조인문으로도 가능
where 키 > ( 서브쿼리 )
==> 서브쿼리가 인자로 사용됨
== 일반적으로 where 절에 subquery 가 많이온다.
from 절에 오는 subquery 는 inline subquery라고 함.
조인문
- 조인절이 반드시 들어감 ( = , > 등 ) <- 양쪽 테이블의 공통 키가 일치할 때 선택
- 조건절 <- 행 선택
subquery 사용
select stu_no, stu_name, stu_height
from student
where stu_height >
(select stu_height
from student
where stu_name ='옥성우') ;
self join 사용
select a.stu_no, a.stu_name, a.stu_height
from student a, student b
where a.stu_height > b.stu_height
and b.stu_name ='옥성우' ;
단일열 부질의
subquery의 반환값이 1개일때
subquery의 결과가 여러 개이면 다중행 연산자 사용
in any all -> 다중행 연산자
in ('A', 'B', 'C') // A 또는 B 또는 C 일 때 참
any // 어느 일부만 만족해도 참
all // 주어진 요소를 모두 만족해야 함
join문과 subquery를 전환할 수도 있음 ( 안 되는 것도 있다 )
다중행 연산자
IN ANY ALL
단일행 연산자
= > >= < <=
from (서브쿼리)
in-line view
view : 실제 테이블을 기반으로 만든 가상의 테이블
집합연산자
union
union all
intersect
minus
똑같은 결과를
1. equi join
2. natural join
3. join using()
4. join on
으로 만들 수 있다.
'DB > Oracle' 카테고리의 다른 글
[Oracle] 데이터 갱신과 트랜잭션 제어 (0) | 2020.05.28 |
---|---|
[Oracle] join과 subquery 연습문제 (0) | 2020.05.27 |
[Oracle] join (0) | 2020.05.26 |
[Oracle SQL] select 연습문제 (61~108) (0) | 2020.05.26 |
[Oracle SQL] select 추가사항 (0) | 2020.05.26 |
Comments