Logo 
Search:

Oracle Articles

Submit Article
Home » Articles » Oracle » OperatorsRSS Feeds

UNION QUERY

Posted By: Henry Evans     Category: Oracle     Views: 6269

This article explains about using UNION QUERY with example.

Customer - orders - salespeople database

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.
  
Share: 

 
 

Didn't find what you were looking for? Find more on UNION QUERY Or get search suggestion and latest updates.

Henry Evans
Henry Evans author of UNION QUERY is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!