![](https://maz.kr/wp-content/uploads/2022/12/sql-union-all-thumbnail.png)
UNION ALL
UNION ALL 명령은 둘 이상의 SELECT 문의 결과 집합을 결합한다.
이 UNION ALL 명령의 결과 값에는 중복 값이 포함된다.
예제
“Customers” 및 “Suppliers” 테이블 모두에서 도시(중복 값도 있음)를 반환한다.
SELECT City FROM Customers UNION ALL SELECT City FROM Suppliers ORDER BY City;
기본 예시
City |
---|
Aachen |
Albuquerque |
Anchorage |
Ann Arbor |
Annecy |
Barcelona |
Barquisimeto |
Bend |
Bergamo |
Berlin |
Bern |
Boise |
Boston |
Brandenburg |
Bruxelles |
Bräcke |
Buenos Aires |
Buenos Aires |
Buenos Aires |
Butte |
Campinas |
Caracas |
Charleroi |
Cork |
Cowes |
Cunewalde |
Cuxhaven |
Elgin |
Eugene |
Frankfurt |
Frankfurt |
Frankfurt a.M. |
Genève |
Graz |
Göteborg |
Helsinki |
I. de Margarita |
Kirkland |
Köln |
København |
Lander |
Lappeenranta |
Leipzig |
Lille |
Lisboa |
Lisboa |
London |
London |
London |
London |
London |
London |
Londona |
Luleå |
Lyngby |
Lyon |
Madrid |
Madrid |
Madrid |
Manchester |
Mannheim |
Marseille |
Melbourne |
Montceau |
Montréal |
Montréal |
México D.F. |
México D.F. |
México D.F. |
México D.F. |
México D.F. |
München |
Münster |
Nantes |
Nantes |
New Orleans |
Osaka |
Oulu |
Oviedo |
Paris |
Paris |
Paris |
Portland |
Portland |
Ravenna |
Reggio Emilia |
Reims |
Resende |
Rio de Janeiro |
Rio de Janeiro |
Rio de Janeiro |
Salerno |
Salzburg |
San Cristóbal |
San Francisco |
Sandvika |
Seattle |
Sevilla |
Singapore |
Stavern |
Ste-Hyacinthe |
Stockholm |
Strasbourg |
Stuttgart |
Sydney |
São Paulo |
São Paulo |
São Paulo |
São Paulo |
São Paulo |
Tokyo |
Torino |
Toulouse |
Tsawassen |
Vancouver |
Versailles |
Walla |
Walla Walla |
Zaandam |
Århus |
참고
W3C School - SQL UNION ALL Keywords
W3C School - SQL Tutorial