I have this table called people
| id | name | lastname |
|---|---|---|
| 1 | John | Smith |
| 2 | Robert | Williams |
| 3 | Peter | Walker |
if I run the query
select CASE WHEN id is null THEN '0' ELSE id END as id
from people
where id='2'
The result is: | id | ---- | 2
I want to display id as 0 when it is Null in the table, but when I run
select CASE WHEN id is null THEN '0' ELSE id END as id
from people
where id='4'
| id |
|---|
My expected result is: | id | ---- | 0