In MySQL, when CREATE TABLE, is there a way for MySQL to implicitly create a column (i.e. a column not explicitly declared in CREATE TABLE command) as the primary key of the table?
Thanks.
解决方案
No, the PRIMARY KEY needs to be defined on the table.
You may be thinking about this, which applies to InnoDB engine:
If the table has no PRIMARY KEY or suitable UNIQUE index, InnoDB
internally generates a hidden clustered index named GEN_CLUST_INDEX on
a synthetic column containing row ID values. The rows are ordered by
the ID that InnoDB assigns to the rows in such a table. The row ID is
a 6-byte field that increases monotonically as new rows are inserted.
Thus, the rows ordered by the row ID are physically in insert