AND
and OR
operators are used to filter records based on multiple conditions.
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.
id | name | age | grade |
---|---|---|---|
1 | Asha | 15 | A |
SELECT * FROM students
WHERE grade = 'B' OR age = 16;
🟢 Result: Shows students who either have grade B or age 16.
id | name | age | grade |
---|---|---|---|
2 | Rohan | 14 | B |
3 | Meena | 16 | A |
()
to control logical evaluation order.