Logical operators help you combine multiple conditions in the WHERE clause.

Operator Description Example
AND Both conditions must be true salary > 50000 AND department = 'Engineering'
OR At least one condition is true department = 'HR' OR department = 'Finance'
NOT Negates a condition NOT department = 'Marketing'

🔹 1️⃣ AND Operator

Both conditions must be satisfied for the row to be selected.

-- Employees in Engineering with salary > 70000
SELECT emp_name, department, salary
FROM employees
WHERE department = 'Engineering' AND salary > 70000;

Explanation:


🔹 2️⃣ OR Operator

Either condition can be true.

-- Employees in HR or Finance
SELECT emp_name, department
FROM employees
WHERE department = 'HR' OR department = 'Finance';

Explanation:


🔹 3️⃣ NOT Operator

Negates a condition.

-- Employees NOT in Engineering
SELECT emp_name, department
FROM employees
WHERE NOT department = 'Engineering';

Explanation: