Easy
Find all navy products
Consider the table ecommerce_products
, which contains a list of products sold by an ecommerce company:
+------------+-------+------------+-------------------------------------------+-------+--------------+------------+------------------------+
| product_id | cost | category | product_name | brand | retail_price | department | distribution_center_id |
+------------+-------+------------+-------------------------------------------+-------+--------------+------------+------------------------+
| 1 | 12.35 | Activewear | XS Nike Men Paragon Swim Shorts 2023 Navy | Nike | 25.99 | M | 1 |
| 2 | 12.35 | Activewear | S Nike Men Paragon Swim Shorts 2023 Navy | Nike | 25.99 | M | 1 |
| 3 | 12.35 | Activewear | M Nike Men Paragon Swim Shorts 2023 Navy | Nike | 25.99 | M | 1 |
| ... | ... | ... | ... | ... | ... | ... | ... |
+------------+-------+------------+-------------------------------------------+-------+--------------+------------+------------------------+
Return the product_id
and product_name
of all products which contain the word 'Navy' in their product_name
.
EXPECTED OUTPUT
+------------+-----------------------------------------------+
| product_id | product_name |
+------------+-----------------------------------------------+
| 1 | Nike Men Paragon Swim Shorts 2023 Navy XS |
| 2 | Nike Men Paragon Swim Shorts 2023 Navy S |
| 3 | Nike Men Paragon Swim Shorts 2023 Navy M |
| ... | ... |
+------------+-----------------------------------------------+
Use WHERE product_name LIKE '%Navy%'
SELECT
product_id,
product_name
FROM ecommerce_products
WHERE product_name LIKE '%Navy%'