Below is the data in the sample table named ‘DATA’. The question is how NULL performs in expressions.

The Question: What will be the result when the below query executed

Table: data

COL1COL 2COL 3
12NULL
Data present in the Table

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?

  1. 3, NULL, 0
  2. 3, 2, 0
  3. 3, 2, 3
  4. 3, NULL, NULL
  5. 3, 2, NULL

The correct answer is ‘Choice 4’.

Fediverse reactions

Discover more from Srinimf

Subscribe now to keep reading and get access to the full archive.

Continue reading