SQL WHERE Clause

The `WHERE` clause in SQL is used to filter records and fetch only those rows that satisfy a specified condition. It is used with SQL statements like `SELECT`, `UPDATE`, and `DELETE`.

Syntax

The basic syntax of the `WHERE` clause is as follows:

SELECT column1, column2, ...
FROM table_name
WHERE condition;

Example

Suppose you have a table named Employees with a column named Age. To get the records of employees who are 30 years old, you would use the following query:

SELECT *
FROM Employees
WHERE Age = 30;

Operators

The `WHERE` clause can use various operators to filter records. Some common operators include:

Notes

Understanding how to use the `WHERE` clause effectively will allow you to filter data according to your needs, making your queries more precise and efficient.