Archives of the TeradataForum
Message Posted: Mon, 05 May 2008 @ 12:45:48 GMT
Did you have a look at the manual? This sort basic thing can be answered by a quick look at the count function in the SQL Functions manual.
* Count(*) counts all occurrences including nulls. This is a row count.
* Count (x) counts all non null occurrences of values in column x. If x has null values, count(x) will be less than count(*).
* Count (1) is like count(x) it will count all null values in a "pseudo column" created by the constant. Since the constant 1 will never be null, this would, like count(*), give you a row count.
Thus with this data in t3:
X y 1 1 Null 2 Null 3 4 4
And this query:
select count(*), count(x), count(1) from t3;
4, 2, 4
|Copyright 2016 - All Rights Reserved|
|Last Modified: 15 Jun 2023|