Last answered:

31 Aug 2022

Posted on:

24 Aug 2022

0

Resolved: Modifying NOT NULL Constraints with Existing Data

Hello,

I tried to modify the NOT NULL constraint of email_address field in customers table. Having one record with NULL email_address, MySQL thrown an error.
image.png
image.png

Suppose we have real data, is there a workaround that we can do to continue the NOT NULL constraint on email_address field?

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

31 Aug 2022

0

Hi Carl!
Thanks for reaching out.

This error message 1138 is because you have already NULL values for the email_address column. Please, remove this record and then run the ALTER TABLE query.

Hope this helps.
Best,
Tsvetelin

Submit an answer