| sri |
Posted: Feb 19, 2008 04:32:40 AM |
Total Post: 13
Joined: Sep, 2007
|
Hi all
If we have a table of only one column ( say a)
and say we have 5 rows of null values in that column
if we say count(*) it will give 5
if we say count(column_name) it will give 0
why the difference between two queries
can any body please let me know
Thanks in advance... |
|
|
Garlapati |
| Posted: Feb 19, 2008 05:10:55 AM | |
|
Total Post: 30
Joined: Apr, 2007
|
count(*) means it takes all duplicate values
but count(column) is not conside null values
it counts only for the perticular column
count(*) means it consider maximum no.of rows are there
|
|
|
|
|
sri |
| Posted: Feb 19, 2008 05:26:54 AM | |
|
Total Post: 13
Joined: Sep, 2007
|
i couldn't get you
can u explain it clearly
|
|
|
|
|
Murtuja |
| Posted: Feb 19, 2008 06:24:49 AM | |
|
Total Post: 857
Joined: Jan, 2006
|
Count on a column does not count nulls.
Count with an asterisk counts all rows even if all columns are null.
|
|
|
|
|
subha |
| Posted: Feb 22, 2008 02:40:21 AM | |
|
Total Post: 2
Joined: Feb, 2008
|
Count(*) considers all rows even it is NULL. Count(Col_Name) ignores NULL values...
|
|
|
|
|
Muhammed El Hedi |
| Posted: Feb 27, 2008 10:30:54 PM | |
|
Total Post: 2
Joined: Feb, 2008
|
select count(column_name) from table_name;
has the same meaning as
select count(*) from table_name where column_name is not null;
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |