Sales table with the Product table on the product_id column.quantity by the price to calculate the spending for each sale.user_id.user_id in ascending order to break ties.
erDiagram
Sales {
int sale_id PK
int product_id FK
int user_id
int quantity
}
Product {
int product_id PK
int price
}
Sales }|--|| Product : has