I am not sure why I am getting this error #1062 - Duplicate entry '1' for key 1 cany any one help explain what it means. Thanks
More than likely your column is set to be Unique, and you're trying to input a row with an ID that already exists in your table.
You are probably trying to insert a record with the ID (or some other field) 1
set, while such a record already exists in the table. The field that is the primary key must have a unique value for each record.
name
, slug, term_group) SELECT d.tid, d.name, REPLACE(LOWER(d.name), ' ', '-'), 0 FROM wrdp1.term_data d INNER JOIN wrdp1.term_hierarchy h USING(tid) it throws this error #1062 - Duplicate entry '1' for key 1 I set the primary key to be unique. –
Terry I think you're trying to insert '1' to a unique key field that already has a '1' value
The problem is related with your file - you are trying to create a DB using a copy - at the top of your file you will find something like this:
CREATE DATABASE IF NOT EXISTS *THE_NAME_OF_YOUR_DB*
DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci;
USE *THE_NAME_OF_YOUR_DB*
;
and I'm sure that you already have a DB with this name - IN THE SAME SERVER - please check.
You need to add primary key with the group in which one primary key must be unique value. e.g. if a table has 4 columns id, name, address, group_id where group_id has duplicate value , if I want to add group_id as primary then that should be in a group consist with id and group_id
© 2022 - 2024 — McMap. All rights reserved.