Introduction
The WHERE clause helps you pick only the rows you want from a table by setting conditions.
SELECT column1, column2 FROM table_name WHERE condition;
SELECT * FROM employees WHERE department = 'Sales';
SELECT name, price FROM products WHERE price < 100;
SELECT * FROM orders WHERE order_date >= '2024-01-01' AND status = 'shipped';
SELECT * FROM students WHERE grade >= 90 OR attendance > 95;
CREATE TABLE employees ( id INT, name VARCHAR(50), department VARCHAR(50), salary INT ); INSERT INTO employees (id, name, department, salary) VALUES (1, 'Alice', 'Sales', 50000), (2, 'Bob', 'HR', 45000), (3, 'Charlie', 'Sales', 55000), (4, 'Diana', 'IT', 60000); SELECT name, salary FROM employees WHERE department = 'Sales';
WHERE clause do in a SQL query?employees where the age is greater than 30?products with columns id, name, and price, what will the query SELECT name FROM products WHERE price <= 50; return?SELECT * FROM orders WHERE status = 'shipped' OR;students with columns id, name, and score. You want to select students who scored between 70 and 90 inclusive. Which query correctly uses the WHERE clause to achieve this?Pass the test and this pattern moves unknown