Question

    In SQL, which aggregate function is most appropriate for

    calculating the total revenue from completed transactions in a sales database?
    A COUNT() Correct Answer Incorrect Answer
    B SUM() Correct Answer Incorrect Answer
    C AVG() Correct Answer Incorrect Answer
    D MAX() Correct Answer Incorrect Answer
    E MIN() Correct Answer Incorrect Answer

    Solution

    Explanation:- The SUM( ) function is the correct choice because it calculates the total sum of a numeric column , such as total sales revenue. In a sales database, the amount column typically stores transaction values. To get the total revenue from completed transactions , we use SUM( ) on the amount column while filtering only completed orders. This ensures that the final result represents the overall revenue generated from valid transactions.   For example, if completed transactions have amounts 500, 1000, and 1500 , SUM( ) will return 3000 , which is the total revenue .  

    Practice Next