WHERE clause MYSQL

The WHERE clause is used to filter records.                                                               

The WHERE clause is used to extract only those records that fulfill a specified condition.

Notes:

It is used to fetch data based on the conditions.

WHERE is followed by a condition that returns either true or false.


Syntax:

SELECT column1, column2, …
FROM table_name
WHERE condition;

Query 1:

SELECT * FROM employees where emp_no=10185


Output:

Where Clause Example


Query 2:

SELECT * FROM employees where last_name='sidhu'

Output:

Where Clause Example

As you see we have fetched all employee’s with last name ‘sidhu’

Tester Usage Tips:

  • Filter records based on condition and validate the records