SQL AND Operator
📘 SQL AND Operator
The AND operator in SQL is used in the WHERE clause to combine two or more conditions.
A row is returned only if all conditions are TRUE.
1. Basic Syntax
2. Example: Filter Rows Using Multiple Conditions
Get employees from the IT department AND earning more than 60,000:
✔ Both conditions must be true.
3. Using AND with Multiple Conditions
4. AND vs OR
-
AND → all conditions must be TRUE
-
OR → at least one condition must be TRUE
Example:
5. AND with Parentheses (Recommended for Complex Logic)
Parentheses help avoid logic mistakes:
6. Using AND with LIKE
7. Using AND with IN
8. Real-World Example
Get active users who signed up after 2023 and verified their email:
