Where Clause in SQL
The Where clause in SQL query is used with the SELECT keyword.' Where' clause search the data with a particular condition. In case the data matches with condition, return you the specific value of particular data value.
Syntax
SELECT column FROM table WHERE column operator value |
The Select is used to retrieve the record from a table.
column : This specify the name of the column, which you want to retrieve from table.
From : The From Keyword specify the name of the table from where data is retrieved.
table :This specify the name of the table.
Where column : The clause where search the data with a particular condition. If data matches with the condition ,return you the specific value of data.
The List of Operator can be used as
Operator | Description |
= | Equal |
BETWEEN | Between an inclusive range |
LIKE |
Search for a pattern |
IN | If you know the exact value you want to return for at least one of the columns |
Understand with Example
The Tutorial illustrate an example from where clause in SQL. In this Tutorial we use a select query to retrieve the record from table 'country'.
select * from country; |
The select query return you the records or rows from table country. In case the data matches with the specified condition, return you the specific value of record.
Output of the above query is
The select query used with where clause, which search the data with a particular condition.
select * from country where countryname='India'; |
Output of the above query is