Can I create an index on a CREATE TABLE
statement?
Ie can I define indexes for a table when I create the table? I mean create the index on the create stamement sql command
Yes, it can be defined in the CREATE TABLE
, the convention is to put these definitions at the end of the list.
CREATE TABLE `example`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`index_col` VARCHAR(20),
PRIMARY KEY (`id`),
INDEX `index_name` (`index_col`)
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.