I've got a database table for users that has a setup similar to this:
+---------------------+--------------+------+-----+------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------------+--------------+------+-----+------------+----------------+
| id_user | int(5) | NO | PRI | NULL | auto_increment |
| login | varchar(50) | NO | | | |
| password | varchar(50) | NO | | | |
| address | varchar(255) | NO | | NULL | |
+---------------------+--------------+------+-----+------------+----------------+
Since the address field is set to not null and the default is null, this should effectively make the address field required, right?
But when I perform a query such as the following:
INSERT INTO mydatabase.users
SET
mydatabase.users.login='test_username',
mydatabase.users.password='test_password'
It successfully saves the user without complaining about the address field, which is set to an empty space.
What could be causing this? I expect an error in this type of situation. I've tried it with MySQL 5.5 and 5.6.