Skip to main content

A template for creating a table in MySQL that contains auto-incrementing identity column.

-- NOTE: replace <database_name>, `<table_name>

CREATE TABLE `<database_name>`.`<table_name>` (
  `id` int UNSIGNED AUTO_INCREMENT,
  PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;