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;


 

Print Friendly, PDF & Email
Character Functions()
Ranking Functions()
Shikha Katariya

Shikha Katariya

Shikha Katariya ,the Blog author is QA Engineer by profession,Currently serving in MNC, She has more than 4 years of experience in software industry and has worked for domains like Insurance , Core & retail Banking. Always keen to learn new technologies , she has working experience in mainframes,informatica ,and ETL Testing.

You may also like...

Leave a Reply

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