community/learn/content/01-SQL-Basics/02-fundamentals/04-where.md
In this exercise we'll query the orders table and return just the rows that equal the employee_id of 8.
SELECT order_id,
customer_id,
employee_id,
order_date
FROM orders
WHERE employee_id=8;
This query should return 104 rows.
In this exercise we'll query the orders table and return just the rows that have an employee_id of 8 and a customer_id equal to "FOLKO".
SELECT order_id,
customer_id,
employee_id,
order_date
FROM orders
WHERE employee_id=8
AND customer_id= 'FOLKO';
This query should return 6 rows.
In this exercise we'll query the orders table and return just the rows that have an employee_id of 2 or 1.
SELECT order_id,
customer_id,
employee_id,
order_date
FROM orders
WHERE employee_id=2
OR employee_id=1;
This query should return 219 rows.
In this exercise we'll query the order_ details table and return just the rows with an order_id of 10360 or 10368.
SELECT *
FROM order_details
WHERE order_id IN (10360,
10368);
This query should return 9 rows.
In this exercise we'll query the customers table and return just the rows that have a company_name that starts with the letter "F".
SELECT customer_id,
company_name,
contact_name,
city
FROM customers
WHERE company_name LIKE 'F%';
This query should return 8 rows.
In this exercise we'll query the orders table and return just the rows that have an order_id between 10,985 and 11,000.
SELECT order_id,
customer_id,
employee_id,
order_date,
ship_postal_code
FROM orders
WHERE order_id BETWEEN 10985 AND 11000;
This query should return 16 rows.
In this exercise we'll query the employees table and return just the rows where the employee_id is not eqal to "1".
SELECT first_name,
last_name,
title,
address,
employee_id
FROM employees
WHERE employee_id <> 1;
This query should return 8 rows.