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
.
The result of the arithmetic operation 5 + NULL in SQL is NULL.
Additional Context:
Correct Answer: (2) NULL.
On a relation named Loan of a bank: