MySQL query -------------- Advanced 9: joint inquiry

# Advanced 9: Union query 
/ * 
of Union joint merger: the results of multiple queries into a single result of the merger 
syntax: 
	Query 2 union ..... sentence 1 union query 

scenarios: to query results from multiple table, and there is no direct connection relationship between the plurality of tables, but consistent, query 
characteristics: 
	(1) a plurality of columns required queries are consistent query statement 
	(2) a plurality of requests for access to the query type of each column and order the best consistent 

* / 

# introduced case: query department number> 90 or employee information mailbox contains a 
select * from employees where department_id> 90 or email like "% a%"; 

use of Union 
the SELECT * from the employees the WHERE department_id> 90 
Union 
SELECT * WHERE In Email like from the Employees "% A%";

  

Guess you like

Origin www.cnblogs.com/ivyharding/p/11545908.html