AND Operator Examples:
SELECT * FROM employees
WHERE department = 'IT' AND salary > 50000;
This query returns employees working in the "IT" department with a salary of more than 50,000.
SELECT * FROM products
WHERE category = 'Electronics' AND price < 1000 AND stock_quantity > 0;
This query returns the products in the electronics category with a price less than 1000, which are also in stock.
OR Operator Examples:
SELECT * FROM customers
WHERE city = 'New York' OR city = 'Los Angeles';
This query retrieves customers living in New York or Los Angeles using the or condition.
SELECT * FROM orders
WHERE order_status = 'Shipped' OR (order_status = 'Processing' AND payment_status = 'Paid');
This query returns orders with order status "Shipped" or orders with order status "Processing" and payment status "Paid".
AND and OR Combination:
SELECT * FROM products
WHERE (category = 'Clothing' AND price < 50) OR (category = 'Electronics' AND stock_quantity > 0);