🔹 AND / OR Operators

The AND and OR operators are used to filter records based on multiple conditions.
  • AND: All conditions must be true.
  • OR: At least one condition must be true.
SELECT column1, column2 
FROM table_name 
WHERE condition1 AND/OR condition2;
SELECT * FROM students 
WHERE grade = 'A' AND age < 16;

🟢 Result: Shows students with grade A and age less than 16.

idnameagegrade
1Asha15A
SELECT * FROM students 
WHERE grade = 'B' OR age = 16;

🟢 Result: Shows students who either have grade B or age 16.

idnameagegrade
2Rohan14B
3Meena16A
⚠️ Common Mistake: Using `AND` and `OR` without proper grouping may lead to incorrect results.
Use parentheses () to control logical evaluation order.
💡 Use `AND` when all conditions must be met, and `OR` when any one condition is enough.