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

StudentIDStudent_NameAddressCity
1NithinBank StreetHyderabad
2BharathWhite FieldBangalore
3GouthamAvenue colonyHyderabad
4BhargavJames streetHyderabad
5VarunPark AvenueChennai

 

SELECT * FROM Student WHERE City=’Hyderabad’;

 

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

The output will be displayed as

StudentIDStudent_NameAddressCity
1NithinBank StreetHyderabad
3GouthamAvenue colonyHyderabad
4BhargavJames streetHyderabad