Unique constraint assignment error message
Why is it giving me the error message of duplicate?
ALTER TABLE customers
ADD COLUMN gender ENUM('M','F') AFTER last_name;
INSERT INTO customers (first_name, last_name, gender, email_address, number_of_complaints)
VALUES ('John', 'Mackinley', 'M', 'john.mckinley@365datascience.com', 0);
06:03:14
ALTER TABLE customers ADD COLUMN gender ENUM('M','F') AFTER last_name
0 row(s) affected Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE customers ADD COLUMN gender ENUM('M','F') AFTER last_name
Error Code: 1060. Duplicate column name 'gender'
0.000 sec
Hi Nike!
Thanks for reaching out!
You add two times the same column. Also, you should provide a value for the customer_id column. Please, use the following code:
ALTER TABLE customers ADD COLUMN gender ENUM('M','F') AFTER last_name;
INSERT INTO customers (customer_id, first_name, last_name, gender,email_address, number_of_complaints)
, VALUES (1, 'John', 'Mackinley', 'M', 'john.mckinley@365datascience.com', 0);
Hope this helps.
Best,
Tsvetelin