SQL Tutorial

SQL AND Operator – Filter Multiple Conditions with Examples (2026)

The SQL AND operator is used to combine two or more conditions in a WHERE clause. A row is included in the result only when ALL conditions joined by AND are true at the same time. This makes AND one of the most powerful filtering tools in SQL — letting you narrow results precisely by department, salary, city, date, or any combination of columns. In this beginner-friendly guide you will learn the AND syntax, see four real examples — including AND with OR and AND with three conditions — and understand the most common mistakes to avoid.



✅ What is the SQL AND Operator?

✅ The SQL AND operator is a logical operator used inside a WHERE clause to filter rows.

✅ It combines two or more conditions — a row appears in results only if every condition is true.

✅ If even one condition is false, the entire row is excluded from the result.

💡 Real-world example: You want to find employees who work in the IT department AND earn more than ₹10,000. Using AND means BOTH conditions must be met — an IT employee earning ₹8,000 would NOT appear in results.

Sample Employees Table:-

Employees
IDNameDepartmentSalaryCity
1ANNIIT10000Mumbai
2POOJAIT90000Pune
3RAJHR5000Pune
4SUJANHR8000Delhi
5MEENASales12000Mumbai

✅ SQL AND Syntax

SELECT column1, column2, ...
FROM table_name
WHERE condition1 AND condition2 AND condition3 ...;

SELECT:- Columns you want to retrieve.

FROM:- The table to query data from.

WHERE:- Starts the filtering section.

AND:- Joins conditions — all must be true for a row to be returned.

ℹ️ Key rule: Every condition separated by AND must evaluate to TRUE for the row to appear. One FALSE condition = row excluded.

✅ Example – IT Department AND Salary > 10000

SELECT Query:-

SELECT * FROM Employees
WHERE Department = 'IT' AND Salary > 10000;

Result:-

Result — IT employees earning more than 10000
IDNameDepartmentSalaryCity
2POOJAIT90000Pune
💡 Why only POOJA? ANNI is in IT but earns exactly 10000 — the condition is > 10000 (greater than, not equal). POOJA earns 90000 so she passes both conditions.

✅ Example – HR Department AND City is Pune

SELECT Query:-

SELECT * FROM Employees
WHERE Department = 'HR' AND City = 'Pune';

Result:-

Result — HR employees in Pune
IDNameDepartmentSalaryCity
3RAJHR5000Pune

SUJAN is in HR but lives in Delhi — so only RAJ matches both conditions.


✅ Example – Three AND Conditions

You can chain as many AND conditions as you need. Every condition must be true simultaneously.

SELECT Query:-

SELECT * FROM Employees
WHERE Department = 'IT'
  AND City = 'Pune'
  AND Salary < 10000;

Result:-

Result — IT employees in Pune earning less than 10000
IDNameDepartmentSalaryCity
No rows returned — no employee matches all three conditions
ℹ️ Why no results? POOJA is IT + Pune but earns 90000 (not less than 10000). ANNI is IT but is in Mumbai. No employee satisfies all three conditions simultaneously — so the result is empty.

✅ Example – AND Combined with OR

You can mix AND and OR in one query. Use parentheses to group OR conditions — this prevents unexpected results.

SELECT Query:-

SELECT * FROM Employees
WHERE Department = 'IT'
  AND (Salary > 9000 OR Name = 'POOJA');

Result:-

Result — IT employees earning > 9000 OR named POOJA
IDNameDepartmentSalaryCity
2POOJAIT90000Pune
⚠️ Always use parentheses with AND + OR! Without brackets, SQL evaluates AND before OR, which can return wrong rows. With brackets, you control exactly which conditions are grouped.

✅ AND vs OR – Key Differences

FeatureSQL ANDSQL OR
Condition requirementALL conditions must be trueAT LEAST ONE condition must be true
Rows returnedFewer rows (more restrictive)More rows (more permissive)
Use caseFind IT employees in PuneFind IT or HR employees
One false conditionRow excludedRow still included if another is true

✅ Key Points to Remember

✅ ALL conditions must be true — AND is strict. One false condition removes the row.

✅ Chain as many as neededWHERE A AND B AND C AND D is valid SQL.

✅ Text values need single quotesWHERE Department = 'IT' not = IT.

✅ Use parentheses when mixing AND + OR — prevents logic errors.

✅ AND evaluates before OR — without parentheses A AND B OR C means (A AND B) OR C.

✅ AND works with all data types — text, numbers, dates, boolean.


✅ Common SQL AND Mistakes to Avoid

❌ Mistake 1: Missing single quotes around text values
Wrong: WHERE Department = IT AND City = Pune
Correct: WHERE Department = 'IT' AND City = 'Pune'
Text values must always be wrapped in single quotes.
❌ Mistake 2: Mixing AND and OR without parentheses
Wrong: WHERE Department = 'IT' AND Salary > 5000 OR City = 'Pune'
Correct: WHERE Department = 'IT' AND (Salary > 5000 OR City = 'Pune')
Without parentheses AND is evaluated first, which changes the meaning entirely.
❌ Mistake 3: Repeating the column name incorrectly
Wrong: WHERE Department = 'IT' AND 'HR'
Correct: WHERE Department = 'IT' OR Department = 'HR'
Each condition needs the full column name, operator, and value.
❌ Mistake 4: Using AND when OR is needed
If you write WHERE Department = 'IT' AND Department = 'HR', no row can be in both departments simultaneously — result will always be empty. Use OR when you want either department.

✅ Frequently Asked Questions (FAQ)

What does the SQL AND operator do?
The SQL AND operator combines two or more conditions in a WHERE clause. A row is included in the result only if ALL conditions joined by AND are true at the same time.
What is the difference between SQL AND and OR?
AND requires ALL conditions to be true — it returns fewer rows. OR requires at least ONE condition to be true — it returns more rows. AND is more restrictive; OR is more permissive.
Can I use more than two conditions with AND?
Yes. You can chain as many AND conditions as needed: WHERE Department = 'IT' AND City = 'Pune' AND Salary < 10000. All conditions must be true simultaneously for a row to appear.
Can I combine AND and OR in the same query?
Yes. Use parentheses to control precedence: WHERE Department = 'IT' AND (Salary > 9000 OR City = 'Pune'). Without parentheses, AND is evaluated before OR, which can give unexpected results.
Does SQL AND work with text and number columns?
Yes. AND works with any data type — text (VARCHAR), numbers (INT, DECIMAL), dates (DATE), and boolean values. Always wrap text values in single quotes: WHERE Department = 'IT'.
What happens if one AND condition is false?
If any one condition in an AND chain is false, the entire row is excluded from the result. ALL conditions must be true for the row to appear — that is the defining rule of the AND operator.

✍️ About the Author: Pramod Behera

Pramod Behera is a SAP and SQL educator with 10+ years of experience in enterprise software and database systems. He founded LearnToSAP.com to help beginners learn SAP and SQL concepts through clear, practical, real-world examples. His tutorials have helped thousands of students and IT professionals across India and beyond.