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

suppose we have values like 1 5 7 in a colum.Now we want
numbers like(2 3 4 6) that exists between 1 5 7.How can we
do this using sql query??

Answer Posted / elumalai d

--QUESTION36:-What is different between union and minus?

UNOIN:- it returns all the records from both tables without duplicates.
Example:-
A={1,2,3,4}
B={2,3,4,5,6}
AUB={1,2,3,4,5,6}

CREATE TABLE question36 (empid NUMBER);
CREATE TABLE quest36 (empid NUMBER);

INSERT INTO question36 VALUES(1);
INSERT INTO question36 VALUES(2);
INSERT INTO question36 VALUES(3);
INSERT INTO question36 VALUES(4);

INSERT INTO quest36 VALUES(2);
INSERT INTO quest36 VALUES(3);
INSERT INTO quest36 VALUES(4);
INSERT INTO quest36 VALUES(5);
INSERT INTO quest36 VALUES(6);
COMMIT;

SELECT empid FROM question36
UNION
SELECT empid FROM quest36;

DELETE FROM question36;
DELETE FROM quest36;
COMMIT;

MINUS:- it returns table A values not available in table B.
Example:-
A={1,2,3,4}
B= {2,3,5}
A-B={1,4}

INSERT INTO question36 VALUES(1);
INSERT INTO question36 VALUES(2);
INSERT INTO question36 VALUES(3);
INSERT INTO question36 VALUES(4);

INSERT INTO quest36 VALUES(2);
INSERT INTO quest36 VALUES(3);
INSERT INTO quest36 VALUES(5);
COMMIT;

SELECT empid FROM question36
MINUS
SELECT empid FROM quest36;

DROP TABLE question36;
DROP TABLE quest36;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between left and left outer join?

891


What are the two types of exceptions.

1103


What is difference between nchar and nvarchar?

953


What is the difference between having clause and where clause?

1005


How many sql are there?

922


what is try_catch block in procedure

1653


what are the different functions in sorting an array? : Sql dba

965


What is the difference between clustered and non-clustered index in sql?

952


What is t sql in sql server?

997


Do we need to rebuild index after truncate?

972


Can two tables have same primary key?

915


What is an alias command?

1000


How many postgresql users are there, worldwide?

988


What is partition in sql query?

943


How to get unique records from a table?

894