Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is different between union and minus?

Answer Posted / rahul gaikwad

Let's consider the difference between Minus and Union using
following examples.

1.create TABLE A AND B With similar structure
2.insert records in Table A and B.
3.Keep some records identical(here 2 rows).
4.find out the difference betwn 2 looking into the output.


CREATE TABLE A(NAME VARCHAR2(30));
INSERT INTO A VALUES('A');
INSERT INTO A VALUES('B');
INSERT INTO A VALUES('C');
INSERT INTO A VALUES('D');
COMMIT;

CREATE TABLE B(NAME VARCHAR2(30));
INSERT INTO b VALUES('A')
INSERT INTO b VALUES('B')
INSERT INTO b VALUES('Y')
INSERT INTO b VALUES('X')
COMMIT;



1) SELECT * FROM A
MINUS
SELECT * FROM B

NAME
------------------------------
C
D
2 rows selected



2)SELECT * FROM A
UNION
SELECT * FROM B


NAME
------------------------------
A
B
C
D
Y
x
6 rows selected

Is This Answer Correct ?    28 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many types of normalization are there?

946


What is pl sql variable?

962


Explain the update statement in sql

971


What is sql procedures and functions?

992


How do you use collections in procedure to return the resultset?

2229


What is difference between function and trigger?

1024


What is tuple in sql?

1050


What is clause?

1127


How do I run a sql query?

1001


What is a delimiter in sas?

1035


How do I write a cron which will run a sql query and mail the results to agroup?

960


what are date and time functions in mysql? : Sql dba

964


What is the difference between function, procedure and package in pl/sql?

1223


what is “go” in t-sql? : Transact sql

1088


Explain spool.

1161