By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table t(id int null, id2 int null);
insert into t values (1, 1), (1, null), (3, 3), (null, null)
select count(*) as count
from t
count |
---|
4 |
select distinct *
from t
id | id2 |
---|---|
1 | 1 |
1 | null |
3 | 3 |
null | null |
select count(*) as count
from (select distinct *
from t) x
count |
---|
4 |
select count(distinct id, id2) as count
from t
count |
---|
2 |