Users
table as the base for the query to ensure all users are included in the results.Orders
table on the condition that the user_id
matches the buyer_id
and the order_date
is within the year 2019.user_id
to consolidate orders per user.user_id
(aliased as buyer_id
), join_date
, and the count of orders as orders_in_2019
.user_id
to organize the output.erDiagram Users { int user_id date join_date varchar favorite_brand } Orders { int order_id date order_date int item_id int buyer_id int seller_id } Items { int item_id varchar item_brand } Users ||--o{ Orders : "" Orders }|--|| Items : ""