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 a database? : Sql dba

703


Can you rollback after commit?

626


Can function return multiple values in sql?

633


How do I install sql?

598


How do you update f as m and m as f from the below table testtable?

1285






Which constraints we can use while creating database in sql?

697


What is pragma in sql?

705


Can primary key be changed?

595


Is pl sql and postgresql same?

672


What is sql exception?

621


Why do we use joins?

671


What are inner and outer joins examples of both?

576


Is microsoft sql free?

699


Which sql most popular?

656


Which sql statement is used to delete data from a database?

559