Answer:
Hi there! The answer to this question is:
SELECT DISTINCT category_name FROM categories c WHERE category_id IN (SELECT category_id FROM products)
Please refer to the explanation below.
Step-by-step explanation:
This question is testing your knowledge on the database querying language to retrieve rows of data from the database. A fast way to retrieve data from the SQL database is by using a join if more than one table is being queried, since there is a direct link to the table. We can also write the statement instead with a sub-query included in the where clause to specify the filter conditions:
SELECT DISTINCT category_name FROM categories c WHERE category_id IN (SELECT category_id FROM products)