Is there a way to make an entire MySQL row unique

后端 未结 5 627
醉梦人生
醉梦人生 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:04

    You need a composite primary key.

    A composite primary key tells MySQL that you want your primary key to be a combination of fields.

    More info here: Why use multiple columns as primary keys (composite primary key)

提交回复
热议问题