Skip to content

MAXVALUE

CREATE TABLE employees (
id INT AUTO_INCREMENT,
name VARCHAR(255),
birth_date DATE,
PRIMARY KEY (id)
) AUTO_INCREMENT = 1 MAXVALUE 99999;

MySQL doesn’t provide direct output for MAXVALUE used in the above way. The MAXVALUE 99999 here just limits the id field to not exceed it.

The MAXVALUE keyword in SQL specifies the maximum value a sequence of numbers can have. When we specify MAXVALUE for AUTO_INCREMENT in a MySQL CREATE TABLE statement, MySQL will stop generating new numbers for the id column once it reaches the specified MAXVALUE.