Click here to Skip to main content
15,396,019 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
insert into production.brands (brand_id, brand_name)
values ('12', 'reddy');

What I have tried:

insert into production.brands (brand_id, brand_name)
values ('12', 'reddy');
Posted
Updated 15-Jun-22 9:34am

This error is because you are trying to insert a record with a key of 12 when a record already exists in the table with a key of 12.
   
The error is pretty explicit: you are trying to enter a row containing a value in the Primary Key column which is already in a different row.

Primary keys must be unique: you cannot have any duplicates under any circumstances.
Whatever you are trying to do, you probably need to rethink your whole design.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900