Last answered:

14 Nov 2022

Posted on:

12 Nov 2022

0

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
image.png
Here is the result in the table.
image.png

1 answers ( 1 marked as helpful)
Instructor
Posted on:

14 Nov 2022

0

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

Submit an answer