in reply to Re^3: Perl and MySQL: Get number of rows affected
in thread Perl and MySQL: Get number of rows affected
But look at the example:
Being processed by MySQL (you must specify your DB name, of course), it prints: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;
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.+-----------+--------------+----------+ | COUNT(id) | COUNT(value) | COUNT(*) | +-----------+--------------+----------+ | 3 | 2 | 3 | +-----------+--------------+----------+
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.
|
|---|