Examples of the COUNT column Function
In the following example the user wants to know how many non-NULL values are in the ship_instruct column of the orders table. The user invokes the COUNT(column) function in the Projection list of the SELECT statement:
SELECT COUNT(ship_instruct) AS total_notnulls FROM orders;
The following table shows the result of this query.
total_notnulls |
---|
21 |
A similar query for non-NULL values in the ship_instruct column can include the ALL keyword in the parentheses that follow the COUNT keyword:
SELECT COUNT(ALL ship_instruct) AS all_notnulls FROM orders;
The following table shows that the query result is the same whether you include or omit the ALL keyword (because ALL is the default).
all_notnulls |
---|
21 |