IN Operatior in SQL – SQL Server Tutorial

In operation :-

  • It is used to compare column values with multiple values.

Syntax: – in (v1, v2, v3—)

                      Not in (v1, v2, v3—)

Example:- Select * from emp where job in (‘clerk’,’manager’)

  • Display employee list who are not working for 10 (or) 20th departments.

Example:- select * from emp where deptno not in (10, 20)

Display employee records earning between 2000&5000 and earning multiple of 50 working as clerk (or) manager & not dept in 10&20.

Example:– Select * from emp where sal between2000 and 5000 and Sal%50=0 and Job in(‘clerk’,’manager’) and Deptno not in (10, 20)

Leave a Reply

Your email address will not be published. Required fields are marked *