1158. Market Analysis I
https://leetcode.com/problems/market-analysis-i
Description
Table: Users
+----------------+---------+
| Column Name | Type |
+----------------+---------+
| user\_id | int |
| join\_date | date |
| favorite\_brand | varchar |
+----------------+---------+
user\_id is the primary key of this table.
This table has the info of the users of an online shopping website where users can sell and buy items.Table: Orders
+---------------+---------+
| Column Name | Type |
+---------------+---------+
| order\_id | int |
| order\_date | date |
| item\_id | int |
| buyer\_id | int |
| seller\_id | int |
+---------------+---------+
order\_id is the primary key of this table.
item\_id is a foreign key to the Items table.
buyer\_id and seller\_id are foreign keys to the Users table.Table: Items
Write an SQL query to find for each user, the join date and the number of orders they made as a buyer in 2019.
The query result format is in the following example:
ac
Last updated
Was this helpful?