A sequence is an object that generates a sequence of numeric values, as specified by the CREATE SEQUENCE statement. Sequences are an alternative to AUTO_INCREMENT when you want more control over how sequence numbers are generated.
SEQUENCE caches values, it can sometimes be faster. Also, you can access the last value generated by all used sequences; it's not subjected to limitations of LAST_INSERT_ID( ).
MariaDB starting with 10.3
CREATE SEQUENCE is being introduced in MariaDB 10.3. Details may still change before 10.3 is released as beta.
This section is about sequence objects. For details about the storage engine, see Sequence Storage Engine.
Sequence OverviewObject that generates a sequence of numeric values
CREATE SEQUENCECreates a sequence that generates new values when called with NEXT VALUE FOR
SHOW CREATE SEQUENCEShows the CREATE SEQUENCE statement that created the sequence
ALTER SEQUENCEChange options for a SEQUENCE
DROP SEQUENCEDeleting a SEQUENCE
SEQUENCE FunctionsFunctions that can be used on SEQUENCEs