Can a database table be without a primary key?

前端 未结 11 557
谎友^
谎友^ 2021-01-31 14:39

Can anyone tell me if a table in a relational database (such as MySQL / SQL SERVER) can be without a primary key?

For example, I could have table day_temperature

11条回答
  •  闹比i
    闹比i (楼主)
    2021-01-31 15:06

    When you replicate a database on mysql, A table without a primary key may cause delay in the replication.

    http://lists.mysql.com/mysql/227217

    The most common mistake when using ROW or MIXED is the failure to verify that every table you want to replicate has a PRIMARY KEY on it. This is a mistake because when a ROW event (such as the one documented above) is sent to the slave and neither the master's copy nor the slave's copy of the table has a PRIMARY KEY on the table, there is no way to easily identify which unique row you want replication to change.

提交回复
热议问题