nerdexam
DatabricksDatabricks

CERTIFIED-DATA-ANALYST-ASSOCIATE · Question #67

CERTIFIED-DATA-ANALYST-ASSOCIATE Question #67: Real Exam Question with Answer & Explanation

The correct answer is A: SELECT customer_name, count(order_id) AS number_of_orders. Option A is correct because it uses count(order_id) to count rows per customer and the AS keyword to explicitly alias the result column as number_of_orders, which matches the expected output header exactly. B is a common trap - omitting AS is actually valid SQL syntax (implicit a

Question

A data analyst wants the following output: customer_name number_of_orders John Doe 388 Zhang San 234 Which statement will produce this output?

Options

  • ASELECT customer_name, count(order_id) AS number_of_orders
  • BSELECT customer_name, count(order_id) number_of_orders
  • CSELECT customer_name, (order_id) number_of_orders
  • DSELECT customer_name, count(order_id)

Explanation

Option A is correct because it uses count(order_id) to count rows per customer and the AS keyword to explicitly alias the result column as number_of_orders, which matches the expected output header exactly.

  • B is a common trap - omitting AS is actually valid SQL syntax (implicit aliasing works in most databases), so B would also produce the correct output in practice; however, exam questions often treat AS as required for clarity, making A the "more correct" choice.
  • C is wrong because (order_id) without count() is not an aggregate function - it just references the column value, not a count of orders.
  • D is wrong because without an alias, the column header would appear as count(order_id) (or similar database-specific label), not number_of_orders.

Memory tip: Think "AS = Alias Stated" - whenever you need a specific column name in the output, always use AS to make your intent explicit and unambiguous on an exam.

Community Discussion

No community discussion yet for this question.

Full CERTIFIED-DATA-ANALYST-ASSOCIATE PracticeBrowse All CERTIFIED-DATA-ANALYST-ASSOCIATE Questions