| René Nyffenegger's collection of things on the web | |
|
René Nyffenegger on Oracle - Most wanted - Feedback
|
count aggregate function [Oracle SQL] | ||
count (*) count (expression) count (all expression) count (distinct expression) count (expression) over (analytic-clause)
If expression in count(expression) evaluates to null, it is not counted:
create table count_null (
a number,
b number
);
insert into count_null values ( 1, 5);
insert into count_null values ( null, 7);
insert into count_null values ( null, null);
insert into count_null values ( 8, 2);
select count(a) count_a_not_null,
count(b) count_b_not_null,
count(*) count_all
from count_null;
COUNT_A_NOT_NULL COUNT_B_NOT_NULL COUNT_ALL
---------------- ---------------- ----------
2 3 4
|