use of IN/ANY/ALL

Answer Posted / bunty

IN - used to select multiple rows based on any of the key
provided

SQL - select distinct employeeid from orders where orderid
in ( select orderid from orderdetails where discount >= 10)


ANY - used in case of relational queries to compare result
with any of the key.

SQL - select custID from orders where regionID != "E" and
discount > any (select discount from orders where regionID
= "E" and discount > 3)

ALL - used in case of relational queries to compare result
with all of the keys.

SQL - select custID from orders where regionID != "E" and
discount > all (select discount from orders where regionID
= "E" and discount > 3)

Cheers -
Bunty

Is This Answer Correct ?    11 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is self join and what is the requirement of self join? : Sql dba

683


How do I filter in sql profiler?

538


How can you know that statistics should be updated?

606


What is the use of partition by in sql?

517


What is sql trigger example?

541






What is pls_integer in pl sql?

541


What does pl sql developer do?

510


What is sql in oracle?

625


what is the command used to fetch first 5 characters of the string? : Sql dba

1136


Can we use delete in merge statement?

515


how to create a table index in mysql? : Sql dba

597


What is a unique key and primary key and foreign key?

567


What do you mean by dbms? What are its different types?

557


Which sql statement is used to return only different values?

506


Explain aggregate functions are available there in sql?

534