UNION QUERY
- you can put multiple queries together and combine their output using the UNION clause.
- no. and type of cols in both queries should be same.
Find all the salespeople and customers in'ahmd'.
SELECT snum AS CODE,sname AS NAME FROM Salespeople WHERE city='ahmd'
UNION
SELECT cnum,cname FROM Customers WHERE city='ahmd';
- union eliminates duplicate records.
- to include duplicate records use UNION ALL.