SQL Query to describe ‘NULL’ value -Best example

The below is the data in sample table of name ‘DATA’

Table: DATA

COL1     COL2    COL3

1           2          NULL

SQL Query:

SELECT col1 + col2, col2 + col3, col1 + col2 / col3 

FROM data;

Q) What are the three possible values returned by the sample SQL query above?

  • Choice 1 : 3, NULL, 0
  • Choice 2 : 3, 2, 0
  • Choice 3 : 3, 2, 3
  • Choice 4 : 3, NULL, NULL
  • Choice 5 : 3, 2, NULL

The correct answer is ‘Choice 4’.

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.