十.组合查询
两句查询语句之间用UNION连接就行了
select cust_name, cust_contact, cust_email
from customers
where cust_state IN ('IL','IN','MI')
UNION
select cust_name, cust_contact, cust_email
from customers
where cust_name = 'Fun4All';
事实上用OR联结where可以起到同样的效果
注意:用UNION联结的查询必须包含相同的列、表达式或聚集函数
UNION和where一样会自动去除重复出的行,如果需要显示重复,则可用UNION ALL代替UNION