

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: AS Clause in SQL
incomplete
2: SQL Functions
incomplete
3: Between
incomplete
4: Distinct
incomplete
5: Logical Operators – AND
incomplete
6: OR
incomplete
7: In
incomplete
8: Like
incomplete
9: Underscore Operator
incomplete
10: Wildcards Quiz
incomplete
11: Query Practice – Discount Program
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Another variation to the WHERE clause we can use is the IN operator. IN returns true if the first operand matches any of the values in the second operand, and false otherwise. The IN operator is a shorthand for multiple OR conditions.
These two queries are equivalent:
SELECT product_name, shipment_status
FROM products
WHERE shipment_status IN ('shipped', 'preparing', 'out of stock');
SELECT product_name, shipment_status
FROM products
WHERE shipment_status = 'shipped'
OR shipment_status = 'preparing'
OR shipment_status = 'out of stock';
Hopefully, you're starting to see how querying specific data using fine-tuned SQL clauses helps reveal important insights! The larger a table becomes, the harder it becomes to analyze without proper queries.
We want to know which of our users are from the United States, Canada, or Mexico.
Write a SELECT statement that returns the name, age, and country_code fields for every user in the users table with a country_code of US, CA, or MX.