Counting null and non-null values in a single query

后端 未结 26 1074
星月不相逢
星月不相逢 2021-01-29 19:31

I have a table

create table us
(
 a number
);

Now I have data like:

a
1
2
3
4
null
null
null
8
9

Now I need

26条回答
  •  生来不讨喜
    2021-01-29 20:06

    As i understood your query, You just run this script and get Total Null,Total NotNull rows,

    select count(*) - count(a) as 'Null', count(a) as 'Not Null' from us;
    

提交回复
热议问题