Showing posts with label Between and Opearator. Show all posts
Showing posts with label Between and Opearator. Show all posts

Monday, November 24, 2014

Is operator in SQL SERVER

Is operator

Is operator is used to work with null values.

Write a query to get all the employees whose Commission is null
select * from employee1 where comm is null

Write a query to get all the employees whose Commission is not null
select * from employee1 where comm is not null

Write a Query to get the total salary of an employee(comm+sal)
select ename,sal+isnull(comm,0) as Total_sal from employee1

Null with any operation is Null

Thanks
Srinivas

Between and Opearator in SQL SERVER

Between and Opearator

It is used to specify the range.


Write a query to get all the employees whose ids are between 1002 to 1004
select * from employee1 where eid between 1002 and 1004

Write a query to get all the employees whose are hired on 2010
select * from employee1 where hiredate between '01-jan-2010' and '31-dec-2010'

Thanks
Srinivas