Skip to content

SQL AND Operator

Syntax

The AND operator in SQL is used to combine two or more conditions. All conditions must be TRUE for a row to be included in the result.

SELECT column1, column2
FROM table_name
WHERE condition1 AND condition2;

Example

-- Using a single AND
SELECT name, department
FROM employees
WHERE age > 30 AND department = 'HR';
/* Output:
| name | department |
|-------------|------------|
| Alice Brown | HR |
*/
-- Using two ANDs
SELECT name, department
FROM employees
WHERE age > 30 AND department = 'HR' AND salary > 50000;
/* Output:
| name | department |
|-------------|------------|
| Alice Brown | HR |
*/