Bird
0
0

Which of the following is the correct syntax to get the total sales from a table named Orders with a column Amount?

easy📝 Syntax Q12 of 15
SQL - Aggregate Functions
Which of the following is the correct syntax to get the total sales from a table named Orders with a column Amount?
ASELECT COUNT(Amount) FROM Orders;
BSELECT SUM(Amount) FROM Orders;
CSELECT TOTAL(Amount) FROM Orders;
DSELECT ADD(Amount) FROM Orders;
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct aggregate function

    The function to add values is SUM(), so SUM(Amount) is correct.
  2. Step 2: Check syntax correctness

    SUM() is standard SQL; ADD() and TOTAL() are invalid, COUNT() counts rows, not sums.
  3. Final Answer:

    SELECT SUM(Amount) FROM Orders; -> Option B
  4. Quick Check:

    SUM() syntax correct [OK]
Quick Trick: SUM() is the only valid function to add column values [OK]
Common Mistakes:
MISTAKES
  • Using ADD() or TOTAL() which are not SQL functions
  • Using COUNT() instead of SUM()
  • Missing parentheses after SUM

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes