SQL AND Condition
The SQL AND operator ensures multiple conditions must be met simultaneously. It works in SELECT, UPDATE, and DELETE statements, providing precise control over which rows are affected.
Complete Python Course with Advance topics:-
SQL Tutorial:-
Syntax
SELECT columns FROM tables
WHERE condition_1 AND condition_2;
Both conditions must be true for a row to be returned.
AND with SELECT
-- IT employees in Bangalore
SELECT * FROM employees
WHERE Department = 'IT' AND Location = 'Bangalore';
AND with UPDATE
UPDATE employees
SET Location = 'Hyderabad'
WHERE Department = 'Marketing' AND First_Name = 'Rakesh';
AND with DELETE
DELETE FROM employees
WHERE Last_Name = 'Das' AND Location = 'Kolkata';
Combining AND with OR
When mixing operators, use parentheses for clarity. AND has higher precedence than OR:
SELECT * FROM employees
WHERE Department = 'IT'
AND (Location = 'Mumbai' OR Location = 'Delhi');
AND vs OR Quick Recap
- AND: Row matches only if ALL conditions are true.
- OR: Row matches if ANY condition is true.
Download New Real Time Projects:- Click here
Complete Advance AI topics:-
Conclusion
The AND operator is essential for filtering on multiple conditions. Combined with OR and parentheses, it gives you precise control over your queries. For more SQL guides, stay tuned to .
sql where multiple conditions
sql and condition examples
not operator in sql
sql like
sql not equal
sql and or precedence
sql between
sql and condition w3schools