Question:

What is the result of the following arithmetic operation in SQL: SELECT 5 + NULL AS RESULT?

Updated On: June 02, 2025
  • 5
  • NULL
  • 0
  • 5NULL
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Approach Solution - 1

In SQL, when you perform an arithmetic operation involving a NULL value, the result is typically NULL as well. This happens because NULL is treated as an unknown or undefined value, and any arithmetic operation with an unknown value yields an unknown result. Therefore, when executing the query: 

SELECT 5 + NULL AS RESULT;

the arithmetic operation adds the integer 5 to NULL. Since NULL represents an unknown value, the sum is also unknown, resulting in:

NULL

Thus, the correct answer to the SQL operation SELECT 5 + NULL AS RESULT is NULL.

Was this answer helpful?
0
0
Hide Solution
collegedunia
Verified By Collegedunia

Approach Solution -2

The result of the arithmetic operation 5 + NULL in SQL is NULL.

Additional Context:

  • NULL Handling in SQL:
    • Any arithmetic operation with NULL yields NULL
    • NULL represents unknown/missing data
    • Follows three-valued logic (TRUE, FALSE, UNKNOWN)
  • Example Scenarios:
    • 5 + NULL → NULL
    • NULL * 10 → NULL
    • 100 / NULL → NULL
  • Practical Implications:
    • Use IS NULL/IS NOT NULL for checks
    • COALESCE() or ISNULL() to handle NULLs
  • Database Standards:
    • Behavior consistent across MySQL, PostgreSQL, SQL Server
    • ANSI SQL specification requirement

Correct Answer: (2) NULL.

Was this answer helpful?
0
0

CUET Notification