Essential Question: How can I return a range of values?
Mastery Objectives:
SWBAT select a range of data in a query.
SELECT column_name(s) FROM table_name WHERE column_name BETWEEN value1 AND value2;
Resources: Video on Tech Support Career https://www.youtube.com/watch?v=AgMBr6XN15Q
Directions: Run the following queries into the SQL Editor https://www.w3schools.com/sql/trysql.asp?filename=trysql_select_between and take a screenshot of your results. Paste the screenshot into google docs and write a short description description the results. Submit your google doc to google classroom.
SELECT * FROM Products WHERE Price BETWEEN 10 AND 20;
Create a query for products for prices 1-10
SELECT * FROM Products WHERE Price NOT BETWEEN 10 AND 20;
Create a query for products that are not between 20 and 30
SELECT * FROM Products WHERE Price BETWEEN 10 AND 20 AND CategoryID NOT IN (1,2,3);
Create a query for products for prices 5-15 but not in categoryIDs 4-18
SELECT * FROM Products WHERE ProductName BETWEEN 'Carnarvon Tigers' AND 'Mozzarella di Giovanni' ORDER BY ProductName;
Create a query from products for Filo Mix to Konbu and order by price
SELECT * FROM Products WHERE ProductName BETWEEN "Carnarvon Tigers" AND "Chef Anton's Cajun Seasoning" ORDER BY ProductName;
Create a query from products where the supplierID is from 3-10 and order by ProductName
SELECT * FROM Products WHERE ProductName NOT BETWEEN 'Carnarvon Tigers' AND 'Mozzarella di Giovanni' ORDER BY ProductName;
Create a query from products that is not between Chocolade and Geitost order by price
SELECT * FROM Orders WHERE OrderDate BETWEEN #07/01/1996# AND #07/31/1996#;
Create a query from orders for dates May 5, 1996 to July 12, 1996 using the format above
SELECT * FROM Orders WHERE OrderDate BETWEEN '1996-07-01' AND '1996-07-31';
Create a query from orders for dates January 1, 1996 to February 14, 1996 using the format above