The orders table has multiple orders per customer with order number as the primary key, so the overall average cannot be calculated directly using average on the orders table. Should use total amount / total distinct customer count to calculate overall customer average. Use distinct count to get unique customer numbers.
正确答案是:D: sum(Product Amount)/distinctcount(Customer Name)
专业分析如下:
在这个问题中,我们需要计算所有客户的平均购买金额。为了实现这一点,我们需要使用聚合函数来处理订单详情表中的数据。
选项分析:
- A: average(Customer Name) —— 这个选项是错误的,因为客户名称是一个文本字段,不能进行平均计算。
- B: average(Product Amount) —— 这个选项也是错误的,因为它仅计算每个订单的产品金额的平均值,而不是所有客户的平均购买金额。
- C: sum(Product Amount)/count(Customer Name) —— 这个选项不完全正确,因为它将总产品金额除以所有订单的数量,而不是客户的数量。
- D: sum(Product Amount)/distinctcount(Customer Name) —— 这个选项是正确的。它将总产品金额除以唯一客户的数量,从而计算出每个客户的平均购买金额。
因此,正确答案是 D: sum(Product Amount)/distinctcount(Customer Name)。