
1. Setting During Table Creation:
create table table123(
`id` varchar(100) NOT NULL,
`name` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Test Table';
2. Operations on an Existing Table:
Add Primary Key:
alter table table23 add primary key(id); # Set one
alter table table23 add primary key(id,name); # Set multiple
Remove Primary Key:
alter table table23 drop primary key;