add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table test (column1 int, column2 int, column3 int);
insert into test values (1,2,3);
insert into test values (1,NULL,NULL);
insert into test values (NULL,4,5);
insert into test values (NULL,NULL,6);
insert into test values (0,0,0);
insert into test values(NULL,NULL,NULL);
SELECT column1, column2, column3,
column1 + column2 + column3 AS sum,
COALESCE(column1,0) + COALESCE(column2,0) + COALESCE(column3,0) AS sum2,
COALESCE(column1,column2,column3,100) AS value FROM test;
column1 column2 column3 sum sum2 value
1 2 3 6 6 1
1 null null null 1 1
null 4 5 null 9 4
null null 6 null 6 6
0 0 0 0 0 0
null null null null 0 100
SELECT CASE WHEN column1 IS NULL THEN 0 ELSE column1 END AS column1,
COALESCE(column1,0) AS column1_b FROM test;
column1 column1_b
1 1
1 1
0 0
0 0
0 0
0 0