In MySQL, The "AND" and "OR" operators are used to combine multiple conditions in a WHERE clause.
These operators allow us to create more complex conditions by specifying that multiple conditions must be met "AND" or at least one condition must be met "OR".
The AND operator is used to combine multiple conditions, and it requires that all the specified conditions are true for a row to be included in the result set.
SELECT * FROM products WHERE category = 'GAMES' AND price > 1000;
The OR operator is used to combine multiple conditions, and it requires that at least one of the specified conditions is true for a row to be included in the result set.
SELECT * FROM products WHERE category = 'GAMES' OR category = 'HEALTH_CARE';
We can also use parentheses to control the order of evaluation when combining "AND" and "OR" operators.
SELECT * FROM products WHERE (category = 'GAMES' AND price > 5000) OR (category = 'HEALTH_CARE' AND price > 10000);
The category is 'GAMES' and the price is greater than 5000, OR
The category is 'HEALTH_CARE' and the price is greater than 10000.