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

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

WHERE CLAUSE

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.

where clause

ILLUSTRATION OF WHERE CLAUSE USING ‘BETWEEN’ and ‘LIKE’

WHERE CLAUSE

ILLUSTRATION OF WHERE CLAUSE USING MULTIPLE CONDITIONS :

WHERE CLAUSE

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;


 

Shikha Katariya

Shikha

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *