WHERE Clause in SQL


What is WHERE Clause

The WHERE clause is used to filter individual rows using either a comparison to a literal, or a comparison to another column.
We use WHERE clause to filter elements based on some criteria on individual records of a table.

WHERE clause Syntax-

The basic syntax for the WHERE clause when used in a SELECT statement is as follows.

SELECT column1, column2, ...FROM table_name WHERE condition;

SELECT StudentName From Student WHERE RollNo=10;


SELECT StudentName From Student WHERE RollNo=10;

In Above Example  it will Select the Student Whose Rollno is 10.

Note- Where clause is also used in UPDATE ,DELETE Statement etc…Not Only used in SELECT
The Where clause always used with some conditions.

Where clause Operator
These are the most commonly Used operator in Where Clause

Operator Name                              Description       
=                                                               Equal       
>                                                              Greater than
<                                                              Less than    
>=                                                           Greater than or equal  
<=                                                           Less than or equal       
<>                            Not equal. Note: In some versions of SQL this operator may be written as !=      
BETWEEN                                           Between a certain range        
LIKE                                                      Search for a pattern     
IN                                                           To specify multiple possible values for a column


Post a Comment