We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

In

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.

Assignment

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.