-- for default, count looks only the not null columns. -- so if searching a column, don't mind that -- if you really want to make a condition, try the following: select sum( case when a is not null then 1 else 0 ) from abc...