How do I set the name of a primary key when creating a table?
For example here I\'m trying to create a primary key with the name \'id\', but this is invalid SQL. Can
Alternatively and more widely supported:
CREATE TABLE IF NOT EXISTS `default_test` (
`default_test`.`id` SMALLINT NOT NULL AUTO_INCREMENT,
`default_test`.`name` LONGTEXT NOT NULL,
PRIMARY KEY (`id`)
)
Based on the clarification, you could replace the last definition above with the following if you are to specify the index name:
CONSTRAINT `pk_id` PRIMARY KEY (`id`)