Read the SQL statements in instructions.sql
.
Only one of the following queries will produce 1
, the other two will produce 0
.
Which query will produce the number 1
?
Choice A
select count(*) from example where `status` = "c";
Choice B
select count(*) from example where `status` = "";
Choice C
select count(*) from example where `status` IS NULL;
The prize for working this out (or running the SQL and finding out what happens) is anger.
Want the answer?
Use sql_mode TRADITIONAL.
http://dev.mysql.com/doc/refman/5.7/en/server-sql-mode.html
"Make MySQL behave like a “traditional” SQL database system. A simple description of this mode is “give an error instead of a warning” when inserting an incorrect value into a column."