Comments - Field 'xxxx' doesn't have a default value
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.
fax, company, and org_sponsor are also giving the error.
You haven't provided the queries that are giving the error, but since this looks like an OpenCart installation, it's probably an issue with the OpenCart application sometimes not populating a field. With the definition you've provided, you will get the error you mentioned if you try an insert without specifying a particular value for a NOT NULL field. A query like
or
will work around the error you mention, but you should test if this doesn't have other unforeseen consequences. The application may not handle NULL values correctly, for example.
Thanks Ian... But how can I specify a default value for a field that is primary and auto-increment, such as the customer_id field?
Primary key auto-increments can be made null:
but not given a DEFAULT value, as the AUTO_INCREMENT takes care of that:
You shouldn't get the "Field 'xxxx' doesn't have a default value" error on an auto-increment, so if you are, it would help to find the queries resulting in the problem as well as the table state at the time of these errors.