primary key - Assign same column value on a row repitition in mysql -


how achieve in mysql?

id column primary key

if same occurances of value1 , value2 occurs,assign same id value repeating row,as highlighted below

id | value1 | value2 1  |      | b 2  | c      | d 1  |      | b 2  | c      | d 3  | e      | f 

this not possible. primary key dictates that value (or values in case of composite key) must unique within table.

there couple of options available:

  1. remove primary key (and perhaps instead create index) if rows must saved way in duplicate
  2. do query within application logic determine whether to-be-inserted row data exists, , in such case don't perform insert
  3. create query same (2), perhaps insert .. not exists clause

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -