WHERE Clause in SQL with Example

.

What is the WHERE Clause - How to use the Where Clause in SQL?

Where Clause in SQL with example


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


Syantax of WHERE clause 

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

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


Example of WHERE clause 

SELECT StudentName From Student WHERE RollNo=10;


In the 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 is 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


Hope!!! Above Tutorial on Where Clause with Example is helpful For you...

Team,
QA acharya

Post a Comment

0 Comments