Professional Documents
Culture Documents
Syntax:
Ex:
Ex:
Display the details of employees decreasing their salary by 200.
Ex:
Ex:
Syntax:
Ex:
Display the details of Employees whose salary is equal to 950.
Lessthan(<):
Ex:
Greater than(>):
Ex:
Ex:
Ex:
AND Operator:
Ex :
OR Operator:
Ex :
SQL> SELECT *FROM emp WHERE sal> 1000 OR sal < 2000;
NOT operator:
Ex :
(+ve)Operators (-ve)Operators
IN NOT IN
IN Operator:
Ex:
NOT IN Operator:
Ex:
BETWEEN Operator:
Ex (1):
SQL> SELECT *FROM emp WHERE sal BETWEEN 3000 AND 2000;
O/P:
-- No rows selected
Ex (1):
SQL> SELECT *FROM emp WHERE sal NOT BETWEEN 2000 AND
3000;
NOTE:
LIKE Operator:
Syntax:
Ex (1):
Ex (2):
Display the employees whose name ends with ‘S’ in EMP table
IS NULL Operator:
Syntax:
Ex (1):
O/P:
-- No rows selected;
Ex (2):
Syntax:
Select *from <table Name> Where <column Name> is not null;
Ex (1):
Ex (2):
SYNTAX:
TableA
<set operator>
TableB
<set operator>
Tablec
Operato
r Returns
UNION All distinct rows selected by either query
UNION ALL All rows selected by either query, including all duplicate
s
INTERSECT All distinct rows selected by both queries
MINUS All distinct rows selected by the first query but not the s
econd
Set Operators are-
Ex for UNION:
UNION
UNION ALL
EX for INTERSECT:
INTERSECT
select empno,ename from emp where deptno=30;
Ex for MINUS:
MINUS