The AND operator is a logical operator used to combine two or more conditions in SQL. A row is returned only when all conditions connected using AND are true. AND is commonly used with WHERE when a business requirement contains multiple conditions that must be satisfied at the same time.
Business requirements often contain multiple conditions. For example, a manager may want employees from the Finance department whose salary is above ₹75,000. AND allows both conditions to be applied together.
Find employees who belong to the Finance department and earn more than ₹75,000.
SELECT
EmployeeName,
Department,
Salary
FROM Employees
WHERE Department = 'Finance'
AND Salary > 75000;
AND is commonly used in customer filtering, financial transactions, employee analysis, sales analysis, compliance checks, and operational reporting.
- AND combines multiple conditions.
- All AND conditions must be true.
- AND is commonly used with WHERE.
- Multiple AND operators can be used.
- AND helps create precise filters.
What does AND do in SQL?
AND combines conditions and requires all of them to be true for a row to satisfy the filter.
When should you use AND?
AND should be used when multiple conditions must be satisfied at the same time.