It seems that you don't know what the NULL values are :) Yes, in the case when the column value is declared as NOT NULL, COUNT(value) is equivalent to COUNT(*).

But look at the example:

CREATE TEMPORARY TABLE testnull0 ( id INT NOT NULL auto_increment, value VARCHAR(100), PRIMARY KEY(id) ) ENGINE=MyISAM; INSERT INTO testnull0 (id, value) VALUES (1, 'hello'), (2, 'googbye'), + (3, NULL); SELECT COUNT(id), COUNT(value), COUNT(*) FROM testnull0;
Being processed by MySQL (you must specify your DB name, of course), it prints:
+-----------+--------------+----------+ | COUNT(id) | COUNT(value) | COUNT(*) | +-----------+--------------+----------+ | 3 | 2 | 3 | +-----------+--------------+----------+
Got the idea? You cannot rely on the suggestion that the value column is declared as NOT NULL, if you did not create the table yorself :) while COUNT(*) always works as expected.

It's REALLY off-topic here, but i think that answering an OT question wrong is worse than answering it right—and even worse than not answering it at all.


In reply to Re^4: Perl and MySQL: Get number of rows affected by Ieronim
in thread Perl and MySQL: Get number of rows affected by Spidy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.