Operators in sql
Arithmatic Operators
+, -, *, /
eq.
Display Employee name and salary incremented by 1000
Select Ename,sal+1000 from emp;
comparison
<, >, <= , >=
= and for not equal to <>, !=, ^=
Logical Operators
AND, OR and Not
Display records of clerks from deptno 10
Select * from emp where job='Clerk' and deptno=10;
Display records of employees who are either Manager or getting salary greater
than 30000
Select * from emp where job='Manager' or sal>=30000;
Display records of employees getting salary between 2000 to 3000
Select * from emp where sal>=2000 and sal<=3000;
Display records of employees other than clerks
Select * from emp where job <> 'Clerk';
Or
Select * from emp where not job='Clerk'
Between Operator
Used to define range
Syntax
between ... and ....
eg.
Display records of employees having salary between 1000 and 2000
Select * from emp where sal between 1000 and 2000;
In operator
In opertor checks perticular expressions equality with the values in a
set. and it returns true if any one value matches with the expression
eg.
Display all employees from deptno 10 and 20
Select * from emp where deptno in (10,20);