Machine-translated by Google. Questions are authored in English.
Top

Discussion

The SQL statement: SELECT Number1 + Number 2 AS Total FROM NUMBER_TABLE; adds two numbers from each row together and lists the results in a column named Total.

  • A.True
  • B.
    False

Answer: A

Correct answer: True

The SELECT list may contain expressions as well as plain columns, so Number1 + Number2 is evaluated once per row and its value returned.

AS Total gives the resulting column a name; without it the heading would be the expression itself, which is awkward for a program or a report to reference. One caution: if either operand is null the whole expression is null, since arithmetic with an unknown value gives an unknown result. COALESCE is the usual remedy where zero is the sensible substitute.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.