Database Reference
In-Depth Information
first than it will be handled first otherwise division, it applies to
subtraction and addition too.
Example:
SELECT ename, sal, sal + sal*5/100 “Next Year Sal”
FROM emp;
Logical Operators and the operators in the Other category can be
best understood by looking at their respective real world
example.
Example:
SELECT sal
FROM emp
WHERE deptno = 30 AND sal > 2000;
The output of the query will be only one column i.e. sal and only
those records will be displayed where department number is 30
and the salary is greater than 2000. So when you use AND
operator it means both conditions needs to satisfy for the record
to appear in the output but in case of OR, either first condition
needs to be true or the second one e.g.
SELECT sal
FROM emp
WHERE deptno = 30 OR sal > 2000;
Example:
SELECT *
FROM emp
WHERE job IN ('CLERK','ANALYST');
The output of the query will be all the coulums of emp table but
only those records where job column contains either “CLERK”
or “ANALYST”. You can also use IN operator as follows.
Search WWH ::




Custom Search