[oracle] sql 집합 λͺ…λ Ήμ–΄ (union, union all, minus, intersect)

2021. 10. 15. 11:42γ†λ°μ΄ν„°λ² μ΄μŠ€

728x90

1. union

select ν•„λ“œλͺ…1, ν•„λ“œλͺ…2 ...

from ν…Œμ΄λΈ”λͺ…1

union

select ν•„λ“œλͺ…1, ν•„λ“œλͺ…2 ...

from ν…Œμ΄λΈ”λͺ…2;

 

 

2. union all

select ν•„λ“œλͺ…1, ν•„λ“œλͺ…2 ...

from ν…Œμ΄λΈ”λͺ…1

union all

select ν•„λ“œλͺ…1, ν•„λ“œλͺ…2 ...

from ν…Œμ΄λΈ”λͺ…2;

union all은 쀑볡을 ν—ˆμš©ν•˜λŠ” 합집합이닀. 

 

 

3. intersect

ꡐ집합 

select ν•„λ“œλͺ…1, ν•„λ“œλͺ…2 ...

from ν…Œμ΄λΈ”λͺ…1

intersect

select ν•„λ“œλͺ…1, ν•„λ“œλͺ…2 ...

from ν…Œμ΄λΈ”λͺ…2;

 

 

4. minus

차집합 

select ν•„λ“œλͺ…1, ν•„λ“œλͺ…2 ...

from ν…Œμ΄λΈ”λͺ…1

minus

select ν•„λ“œλͺ…1, ν•„λ“œλͺ…2 ...

from ν…Œμ΄λΈ”λͺ…2;

 

 

 

 

 

 

 

 

 

 

 

728x90