Below is my table structure
CREATE TABLE IF NOT EXISTS `physicians` (
`physician_id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) NOT NULL,
You have defined the not null value to 'physician_minc':
`physician_minc` varchar(20) NOT NULL,
How can you pass the null value to it.First you need to make the physician_minc
column as null then only you can pass your desired null value.
`physician_minc` varchar(20) NULL,
Update your table as this:
ALTER TABLE `physicians`
CHANGE `physician_minc` `physician_minc` VARCHAR(20) CHARACTER
SET latin1 COLLATE latin1_swedish_ci NULL;
The last values of your insertion are NULL yet declared as not null in the table creation, hence the error.
If physician_minc is not mandatory then allow it to be NULL in the table creation by replacing physician_minc
varchar(20) NOT NULL, into physician_minc
varchar(20) NULL,
Don't define physician_minc as not null
Unlike your query this query will substitute an empty string for null if the columns do not support null values.:
INSERT INTO `physicians` (`user_id`, `physician_gender`, `physician_dob_date`, `physician_dob_month`, `physician_dob_year`, `physician_profession`, `medical_specialty`, `medical_school`, `traning_year`, `physician_minc`, `physician_country`, `physician_state`, `physician_city`, `physician_address`, `physician_postal_code`, `physician_phone_number`, `physician_default_msg`) SELECT 4, 'Female', '5', '7', '1955', '3', '2', '1', '1965', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL;
ALTER TABLE physicians CHANGE `physician_minc` `physician_minc` VARCHAR(20) NULL;