Is there a way to make an entire MySQL row unique

后端 未结 5 630
醉梦人生
醉梦人生 2021-02-14 04:46

I have a table in MySQL with 30 columns and thousands of entries.
Is there a way I could make every row unique, that means if a row already exists, I should not be able to e

5条回答
  •  孤独总比滥情好
    2021-02-14 05:10

    You may create UNIQUE key on all the columns, not individual unique keys on each column. This means that the combination of the values will be unique - exactly what you need. But please note, that if any column allows null value, if the column contains null value, it will be counted as unique, even if another row contains the same values, with null for the same value.

提交回复
热议问题