在MySQL中,设置主键的步骤如下:
示例:
CREATE TABLE example_table (
id INT PRIMARY KEY,
name VARCHAR(50)
);
示例:
ALTER TABLE example_table
ADD PRIMARY KEY (id);
示例:
ALTER TABLE example_table
DROP PRIMARY KEY,
ADD PRIMARY KEY (id);
示例:
CREATE TABLE example_table (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(50)
);