DA0-001 · Question #253
A data analyst has been asked to manipulate the data in the table below by first applying a DISTINCT function, and then applying a SUM function, to get the total product cost for a customer: Which…
The correct answer is B. $6,297. To calculate the final product cost by first applying a DISTINCT function and then a SUM function, one must identify unique product costs from the dataset and then add them together. For the implied dataset, the sum of unique product costs results in $6,297.
Question
A data analyst has been asked to manipulate the data in the table below by first applying a DISTINCT function, and then applying a SUM function, to get the total product cost for a customer:
Which of the following is the final cost of the product?
Exhibit
Options
- A$5,402
- B$6,297
- C$7,634
- D$8,642
How the community answered
(66 responses)- A2% (1)
- B83% (55)
- C5% (3)
- D11% (7)
Why each option
To calculate the final product cost by first applying a DISTINCT function and then a SUM function, one must identify unique product costs from the dataset and then add them together. For the implied dataset, the sum of unique product costs results in $6,297.
A sum of $5,402 would result from a different set of distinct values or an incorrect calculation.
Applying a DISTINCT function first would identify all unique product cost values from the original table. Subsequently, the SUM function would add only these unique values together, avoiding double-counting any repeated product costs to arrive at the total, which for the implied data is $6,297.
A sum of $7,634 would result from a different set of distinct values or an incorrect calculation.
A sum of $8,642 would result from a different set of distinct values or an incorrect calculation.
Concept tested: SQL functions - DISTINCT and SUM
Source: https://learn.microsoft.com/en-us/sql/t-sql/functions/sum-transact-sql?view=sql-server-ver16
Topics
Community Discussion
No community discussion yet for this question.
