SQL Clause

The clauses in SQL are used to execute a query using a condition.

SQL WHERE

SQL WHERE clause is used to extract the data that satisfy the specified condition.

The syntax for SQL WHERE is as follows:

SELECT *
FROM
table_name
WHERE condition;

 

This WHERE clause can be used with SELECT, UPDATE, DELETE Statement etc..,

The operators used in the WHERE clause are:

Example:

Let us take an example of Student table

StudentID Student_Name Address City
1 Nithin Bank Street Hyderabad
2 Bharath White Field Bangalore
3 Goutham Avenue colony Hyderabad
4 Bhargav James street Hyderabad
5 Varun Park Avenue Chennai

 

SELECT * FROM Student WHERE City=’Hyderabad’;

 

Now it will select the Student data that matches with the condition.

The output will be displayed as

StudentID Student_Name Address City
1 Nithin Bank Street Hyderabad
3 Goutham Avenue colony Hyderabad
4 Bhargav James street Hyderabad