SQL AND
The AND
operator in SQL is used to combine multiple conditions in a WHERE
clause. It ensures that all conditions must be true for the record to be included in the result set.
Syntax
SELECT column1, column2, ...
FROM table_name
WHERE condition1 AND condition2 AND ...;
- condition1, condition2, ... – Specifies the conditions that must all be true for a record to be selected.
Example
SELECT Name, Age, Salary
FROM Employees
WHERE Age > 30 AND Salary > 50000;
In this example:
- The query selects records from the Employees table where both conditions are true: the Age is greater than 30 and the Salary is greater than 50,000.