SQL SOME operator


SOME operator is same as IN operator. This operator is rarely used.  
Read more about IN operator here

Syntax:

select columns from table_name where column_name = SOME ( 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 = SOME( 'Bill' , 'Solomon' ,'Wendy');

2. Find details of employee earning highest salary.

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

No comments:

Post a Comment