Auto Increment

Auto Increment

CREATE TABLE IF NOT EXISTS `student` (
    `id` INT AUTO_INCREMENT,
    `name` CHAR(50),
    `email` VARCHAR(50)
);
  • By default, the starting value for AUTO_INCREMENT is 1, and it will increment by 1 for each new record.

Setting AUTO_INCREMENT starting value

ALTER TABLE `student` AUTO_INCREMENT=100;

Last updated

Was this helpful?