I am trying to practice an exercise in the lesson on the COALESCE() function.
In your example, 2 of the department names in the duplicate table are null.
I did not have department d010 or d011 in my table so I have been trying to insert them.
I get an error on every attempt that the department name field does not have a default value.
How did you add those 2 departments?
Great to have you in the course and thanks for reaching out!
Please accept my apologies for the delayed response.
The problem you are facing is that you are trying to add a record in the departments_dup table without specifying data values for every field of the record you are inserting. Please remember that doing this is a must – in other words, when inserting a record, it must be clear to Workbench what value you intend to insert in every field from that record.
This means that we have to always specify values for every field while the only case in which we may skip doing that is if we had set a default value for a certain field that should appear in this field every time when we are adding a new record.
You had done neither of the two, hence the error message you obtain.
Therefore, please either add a DEFAULT constraint to the dept_name field, or just specify the value you wish to insert in this column while inserting a new record.
Hope this helps but please get back to us should you need further assistance. Thank you.