Shopify wants to know if sellers are successful in selling their favorite brands.
Write an SQL query to find for each seller, whether the brand of the second item (by date) they sold is their favorite brand.
| user_id(INTEGER) | join_date(DATE) | favorite_brand(VARCHAR) |
|---|---|---|
| 1 | 2026-01-01 | Apple |
| 2 | 2026-01-02 | Samsung |
| 3 | 2026-01-03 | Sony |
| order_id(INTEGER) | order_date(DATE) | item_id(INTEGER) | seller_id(INTEGER) |
|---|---|---|---|
| 1 | 2026-02-01 | 10 | 1 |
| 2 | 2026-02-02 | 11 | 1 |
| 3 | 2026-02-01 | 12 | 2 |
| item_id(INTEGER) | item_brand(VARCHAR) |
|---|---|
| 10 | Samsung |
| 11 | Apple |
| 12 | Samsung |
| seller_id(INTEGER) | second_item_fav_brand(VARCHAR) |
|---|---|
| 1 | yes |
| 2 | no |
| 3 | no |