The SQL WHERE clause is used to specify a condition while fetching the data from single table or joining with multiple tables.
If the given condition is satisfied then only it returns specific value from the table. You would use WHERE clause to filter the records and fetching only necessary records.
The WHERE clause is not only used in SELECT statement, but it is also used in UPDATE, DELETE statement, etc.
SELECT column1, column2, columnN FROM table_name WHERE [Condition]
id | name | fee |
---|---|---|
11 | Ashwani | 2000 |
12 | Sachin | 3000 |
13 | Deepak | 20000 |
14 | Soun | 200 |
15 | Sanjay | 3000 |
SELECT id,name FROM student WHERE fee=3000
id | name | fee |
---|---|---|
12 | Sachin | 3000 |
15 | Sanjay | 3000 |