Where conditional keyword in MS SQL Server


Where keyword is conditional keyword in SQL Server, It is very important because all filters in SQL Server are applied on table only with the help of Where keyword.


Where keyword is used to filter out the data from table. Where keyword we use with table columns.
It matches a exact data which user gives in condition.

Let consider we have the Shopping table, and we need to select data from table.

list for where clause in sql server

Where keyword examples in SQL Server


Select all rows from table whose price is 1000.

Example

SELECT * FROM tblShoppingList
WHERE Price = 1000

Output

where condition  / clause in sql server


Note : In above example select all rows whose price is 1000.
We use operator with where clause
= (equal to)
< (less than)
<= (less than or equal to)
> (greater than)
>= (greater than or equal to)


Second example of where clause <= (less than equal to)

Select all rows from table whose price is less than or equal to 25000.

Example

SELECT * FROM tblShoppingList
WHERE Price <= 25000

Output

less than or equal to condition in sql server


Another example of where clause >= (greater than equal to)

Select all rows from table whose price is greater than or equal to 25000.

Example

SELECT * FROM tblShoppingList
WHERE Price >= 25000

Output

where condition in sql server with diffrent operator