Pregunta de entrevista de Cognitive Capital

In SQL, is there a difference between "sum(colA)+sum(colB)" and "sum(colA+colB)"? If so, what is it?

Respuesta de la entrevista

Anónimo

1 mar 2016

The answer expected by the interviewer was that sum(colA+colB) wouldn't work if either column contained a null value, whereas sum(colA)+sum(colB) would continue to work. On a personal note, such silliness arises only when someone is incompetent enough to not use NaN to represent missing values.