考试报名
考试报名
考试内容
考试大纲
在线客服
返回顶部

备考刷题,请到

CDA认证小程序

The following is an order table used by an e-commerce company to record purchase information. Please answer the questions based on the table contents: 订单详情表—— order detail table 单号—— order_id 产品ID—— product_id 客户名称—— customer name 产品金额—— product amount Applying the information shown in the above table, the correct aggregate function to calculate the total average purchase amount across all customers is:
A. average(Customer Name)
B. average(Product Amount)
C. sum(Product Amount)/count(Customer Name)
D. sum(Product Amount)/distinctcount(Customer Name)
上一题
下一题
收藏
点赞
评论
题目解析
题目评论(0)

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)。