Difference between revisions of "UNION"

From SQLZOO
Jump to: navigation, search
(Created page with "Make union between different tables to build one single view or request? <div class='ht'> <div class=params>schema:gisq</div> <div> List a number of SELECT statements separate...")
 
Line 1: Line 1:
Make union between different tables to build one single view or request?
+
Make union between different tables to build one single view or  
 
<div class='ht'>
 
<div class='ht'>
 
<div class=params>schema:gisq</div>
 
<div class=params>schema:gisq</div>

Revision as of 12:42, 10 September 2012

Make union between different tables to build one single view or

schema:gisq

List a number of SELECT statements separated by the UNION key word. Be sure that you have the same number of columns in each of the SELECT statements.

 
 
SELECT name FROM bbc WHERE name LIKE 'Z%'
UNION
SELECT name FROM actor WHERE name LIKE 'Z%'
SELECT name FROM bbc WHERE name LIKE 'Z%'
UNION
SELECT name FROM actor WHERE name LIKE 'Z%'
SELECT name FROM bbc WHERE name LIKE 'Z%'
UNION
SELECT name FROM actor WHERE name LIKE 'Z%'
SELECT name FROM bbc WHERE name LIKE 'Z%'
UNION
SELECT name FROM actor WHERE name LIKE 'Z%'
UNION will be available from version 4
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense