Where clause is used to apply condition on to filter the records.
It is used to get the desired record.
Syntax:
SELECT * FROM table_name
where condition; Example: To fetch only the record of roll no. 2 :
SELECT * FROM students
where Roll_NO = 2; This will fetch the values as shown below:
| Roll_NO | Name | Total_Marks | Phone_Number |
| 2 | Rahul | 68 | 2147483647 |
Operators used with where clause:
| Operator | Description |
|---|---|
| = | Equal |
| > | Greater than |
| < | Less than |
| >= | Greater than or equal |
| <= | Less than or equal |
| <> | Not equal. Note: In some versions of SQL this operator may be written as != |
| BETWEEN | Between a certain range |
| LIKE | Search for a pattern |
| IN | To specify multiple possible values for a column |