The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Anybody can ask a question
Anybody can answer
The best answers are voted up and moderated by our team

Null value in a field specified to have no default?

Null value in a field specified to have no default?

Super Learner

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?
Thank you.

1 Answer

365 Team

Hi Mike!
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.

Ready to Learn Data Science?
50% OFF