Introduction
The WHERE clause with AND lets you find rows that match all conditions you want. It helps you get very specific results from your data.
SELECT column1, column2 FROM table_name WHERE condition1 AND condition2;
SELECT * FROM employees WHERE department = 'Sales' AND salary > 50000;
SELECT name, age FROM customers WHERE city = 'New York' AND age >= 21;
SELECT product_name FROM products WHERE price < 20 AND stock > 0;
CREATE TABLE employees ( id INT, name VARCHAR(50), department VARCHAR(50), salary INT ); INSERT INTO employees VALUES (1, 'Alice', 'Sales', 60000), (2, 'Bob', 'Sales', 45000), (3, 'Charlie', 'HR', 55000), (4, 'Diana', 'Sales', 70000); SELECT name, salary FROM employees WHERE department = 'Sales' AND salary > 50000;
WHERE clause with the AND operator do in an SQL query?age is greater than 18 AND city is 'New York'?employees with columns name, department, and salary, what will this query return?SELECT name FROM employees WHERE department = 'Sales' AND salary > 50000;
SELECT * FROM products WHERE price > 100 AND category 'Electronics';
orders with columns order_id, customer_id, status, and total. Write a query to find all orders with status 'shipped' AND total greater than 100, but exclude orders where customer_id is NULL. Which query is correct?Pass the test and this pattern moves unknown