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

how to increment dates by 1 in mysql? : Sql dba

528


What is varchar sql?

598


what are the features and advantages of object-oriented programming? : Sql dba

530


How do I run pl sql in sql developer?

618


How do I edit a stored procedure?

539






Name the different types of indexes in sql and define them.

552


How do I kill a query in postgresql?

539


how to select first 5 records from a table? : Sql dba

499


When to use inner join and left join?

510


What is dml and ddl?

509


Is subquery faster than join?

561


discuss about myisam index statistics collection. : Sql dba

510


What does closing a cursor do?

752


What is crud stand for?

555


Which nosql database is best?

507