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?
I can see why you'd want the 'a' values to change to 'c' values, but that's probably not a very safe thing to do automatically, as it can result in seriously corrupted (and confusing!) data on the off-chance the ENUM field is altered accidentally. And the schema declaration explicitly prevents NULL values, so an empty string is the next best thing.
Bit of a mindfuck, no doubt.