# count(id) on Char(0) column does not work! [duplicate]

I have a column with the type of char(0). some of the rows are NULL and some of them are empty(''). The question is that when I run the following query, the result will be 0. SELECT count(id) FROM test WHERE id IS NULL

but when I run the following query, the result is correct: SELECT count(*) FROM test WHERE id IS NULL

I have one column,why is that the case?

-

## marked as duplicate by gbn, Mark Storey-Smith, Phil, Paul White, Jon SeigelNov 8 '12 at 17:56

Not a dupe I think (at least not of that one: it is asking if count(*) is the same as count(a_not_null_column)) –  Jack Douglas Dec 16 '11 at 11:20

SELECT count(id),count(*) FROM test WHERE id IS NULL

Coincidently, all aggregate functions ignore NULL except COUNT(*)
So, SELECT COUNT(id) FROM test WHERE id IS NULL is guaranteed to return 0 –  ypercube Dec 16 '11 at 13:34