menu

SQL – WHERE Clause

SQL WHERE Clause

SQL WHERE Clause is used to filter the recoreds on the basis of some condition.
This will fetch the results which will fullfill the condition specified.

SQL WHERE Syntax :

SELECT ColumnName1,ColumnName2,ColumnName3 FROM TableName WHERE Condition

Suppose The “Users” Table has following records :

SQL WHERE Clause tableFull

Suppose we have to find those records which have ‘city’ value as “DELHI”

Example 1 – : The Following Example will fetch the results as

Example

SELECT * FROM Users WHERE city = “DELHI”;

The Above Query Will Fetch the results :

resultDelhi

Example 2 – : Fetch The Results where user’s ID is ‘5’

Example

SELECT * FROM Users WHERE ID = “5”;

The Above Query Will Produce the result as :

idResult

Advertisements