Complete the code to select all employees who work in departments listed in the subquery.
SELECT employee_name FROM employees WHERE department_id [1] (SELECT department_id FROM departments WHERE location = 'New York');
The IN operator is used to check if a value matches any value in a list or subquery result.
Complete the code to find all products whose category_id is in the list of categories with more than 100 products.
SELECT product_name FROM products WHERE category_id [1] (SELECT category_id FROM products GROUP BY category_id HAVING COUNT(*) > 100);
The IN operator allows filtering products whose category_id matches any category_id from the subquery.
Fix the error in the query to select customers who have orders in the USA.
SELECT customer_name FROM customers WHERE customer_id [1] (SELECT customer_id FROM orders WHERE country = 'USA');
The IN operator is needed to compare a column to multiple values returned by the subquery.
Fill both blanks to select orders where the product_id is in the list of products priced above 50.
SELECT order_id FROM orders WHERE product_id [1] (SELECT product_id FROM products WHERE price [2] 50);
Use IN to check if product_id is in the subquery list, and > to filter products priced above 50.
Fill all three blanks to select employee names who work in departments located in 'London' and have a salary greater than 50000.
SELECT employee_name FROM employees WHERE department_id [1] (SELECT department_id FROM departments WHERE location = [2]) AND salary [3] 50000;
The query uses IN to filter department_id by those in London, compares location to the string 'London', and filters salary with > for values greater than 50000.