次のような副選択に頼らずに、テーブル内の行数と特定の条件が真の行数をカウントする方法:
create table t (a integer);
insert into t (a) values (1), (2), (null);
select
(select count(*) from t) as total_lines,
(select count(*) from t where a = 1) as condition_true
;
total_lines | condition_true
-------------+----------------
3 | 1