SQL ANY operator


ANY operator is same as IN operator. This operator is rarely used in SQL.  
Read more about IN operator here

Syntax:

select columns from table_name where column_name = ANY ( values )

Examples:- 

Consider below EMP table structure

EmpnoEmpnameSalaryDeptno
10Bill120005
11Solomon100005
12Susan100005
13Wendy90001
14Benjamin75001
15Tom76001
16Henry85002
17Robert95002
18Paul77002

1. Find all details of Bill, Solomon and Wendy employee. 

Select * from EMP where empname = ANY( 'Bill' , 'Solomon' ,'Wendy');

2. Find details of employee earning highest salary.

Select * from EMP where salary = ANY (select max(salary) from EMP) ;

No comments:

Post a Comment