What does k=v do in the context of INSERT INTO tbl VALUES (expr)
When you created the table with this command

CREATE TABLE foo ( x varchar(255) );


columnx was defined with an implicit default of NULL.

When you compare a non-existent variable with a real value as you did before you get NULL.

When it comes to the expression you gave, x=5, you are asking if NULL equals 5. In terms of symantics, NULL cannot by compared with anything:

mysql&gt; select NULL = 5;
+----------+
| NULL = 5 |
+----------+
|     NULL |
+----------+
1 row in set (0.00 sec)


not even with NULL itself

mysql&gt; select NULL = NULL;
+-------------+
| NULL = NULL |
+-------------+
|        NULL |
+-------------+
1 row in set (0.00 sec)


It needs a content context (if that makes any sense).

Anyway, when you tried to evaluate x=5, that gets processed internally as evaluating x, which of course, is NULL with the row coming into existence, followed by making a comparison with a non-NULL value of 5. Since the expression must evaluate as NULL, you essentially did this:

mysql&gt; insert into foo values (NULL);
Query OK, 1 row affected (0.00 sec)

mysql&gt;


which has the same effect as as doing this

mysql&gt; insert into foo values ();
Query OK, 1 row affected (0.01 sec)

mysql&gt;