Resolved: warning instead of an error
Hi,
Trying to insert the phone number into "headquarters_phone_number" gives me a warning instead of the error you get at about 4:26.
This means the phone is registered in the table, but the company name is empty ("", is not null).
I thought the instruction should not add a row since I did not specify the "company_name".
How is it supposed to work? What could be the reason for this difference?
Below I copy some information.
Thanks!
I copy the warning from Workbench:
ACTION:
INSERT INTO companies (headquarters_phone_number) VALUES('+1 (202) 555-0196')
RESPONSE:
1 row(s) affected, 1 warning(s): 1364 Field 'company_name' doesn't have a default value
Here is the result in the table.
Hi Daniel!
Thanks for reaching out.
This is because this column company_name does not have a default value. In the previous versions of MySQL it was error 1364 and it seems that they have changed it to a warning message. When this error appeared the insertion was not successful but now it is successful and the column which does not have a default value is set to an empty string ""
.
Hope this helps.
Best,
Tsvetelin