我正在构建一个应用程序,它将帮助酒吧跟踪顾客的运行标签。然而,有一些关键的曲折:
$22 total (instead of $30)
。请注意,账单是在晚上结束时计算的,而不是按订单计算的。$10 (one-time fee) + 3 * $15 = $55
。通常酒吧老板喜欢检查他们整个晚上的表现,因此我需要快速返回 10K 顾客的运行总额。我猜读写比大约是2:1。这是一个更好的主意吗
让我快速写一个设计
TABLES:
Customer:
- customer_id (primary key)
- name
- other relevant customer information
Drinks:
- drink_id (primary key)
- name
- price
Deals:
- deal_id (primary key)
- required_drinks (a list of drink_ids)
- discounted_price
UpgradeFees:
- upgrade_fee_id (primary key)
- upgrade_fee_name
- upgrade_fee_amount
RunningTotals:
- customer_id (foreign key to Customers table)
- running_total