php - Duplicate records are allowed in table with two primary keys -



php - Duplicate records are allowed in table with two primary keys -

i have table "userdetails" in 2 columns namely "emailid" , "userid" set primary key. don't key violation sql engine when seek insert duplicate values in table. how debug this?

screenshots :

you don't have 2 primary keys, have composite primary key 2 columns considered primary key.

this means both columns together must unique. current screenshot shows while 2 records have same email, respective rows have different userid's, primary (composite) key unique between two, because both emailid , userid not same between 2 records.

read more composite keys here

edit: i'm not exclusively you're trying accomplish, guess want userid primary key, , have emailid unique field.

php mysql sql

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -