AUTO_INCREMENT
Complete AUTO_INCREMENT data type guide for MariaDB. Complete reference for syntax, valid values, storage requirements, and range limits for production use.
Description
CREATE TABLE animals (
id MEDIUMINT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL,
PRIMARY KEY (id)
);
INSERT INTO animals (name) VALUES
('dog'),('cat'),('penguin'),
('fox'),('whale'),('ostrich');SELECT * FROM animals;
+----+---------+
| id | name |
+----+---------+
| 1 | dog |
| 2 | cat |
| 3 | penguin |
| 4 | fox |
| 5 | whale |
| 6 | ostrich |
+----+---------+Setting or Changing the Auto_Increment Value
InnoDB
Setting Explicit Values
Missing Values
Replication
Changing auto_increment_increment and auto_incremenet_offset when adding a new master to a multi-master setup
auto_increment_increment and auto_incremenet_offset when adding a new master to a multi-master setupCHECK Constraints, DEFAULT Values and Virtual Columns
Generating Auto_Increment Values When Adding the Attribute
See Also
Last updated
Was this helpful?

