Where Clause
Where Clause….is used to filter results from SQL statements like Insert,Update,Select,Delete that meet the filter criteria.
Syntax :
SELECT * FROM <Tablename> WHERE <Column> = <Value>;
Sample Database
ILLUSTRATION OF WHERE CLAUSE USING COMPARISON OPERATORS :
WHERE clause can be used in combination with following comparison operators :
= Equal
< Less Than
> Greater Than
<= Less Than Equal To
>= Greater Than Equal To
<> Not Equal To
Similarly like above examples other operators like >=,<=,<> can also be used with WHERE Clause. ‘IN’ operator is used in order to fetch multiple values.
ILLUSTRATION OF WHERE CLAUSE USING ‘AND’ and ‘OR’ Conditions.
ILLUSTRATION OF WHERE CLAUSE USING ‘BETWEEN’ and ‘LIKE’
ILLUSTRATION OF WHERE CLAUSE USING MULTIPLE CONDITIONS :
Queries for Practice :
Ques 1 : Display the employee number and name who are earning comm ?
SQL> Select empno,ename from emp where comm is not null;
Ques 2 : Display the employee number and name who do not earn any comm ?
SQL> Select empno,ename from emp where comm is null;