In MySQL, 0
or NULL
means false and anything else means true. The default truth value from a boolean operation is 1
.
When doing an ORDER BY
, NULL
values are presented first if you do ORDER BY ... ASC
and last if you do ORDER BY ... DESC
.
For a multiple-row insert,
LAST_INSERT_ID()
and mysql_insert_id()
actually return the AUTO_INCREMENT
key from the first of the inserted rows. This enables multiple-row inserts to be reproduced correctly on other servers in a replication setup.