How to use the sequence object introduced in MariaDB 10.0.3
Sequence storage engine confirmation
Sequence storage engine has been added since MariaDB 10.0.3.
|CSV||YES||Stores tables as CSV files||NO||NO||NO|
|MRG_MyISAM||YES||Collection of identical MyISAM tables||NO||NO||NO|
|MEMORY||YES||Hash based, stored in memory, useful for temporary tables||NO||NO||NO|
|MyISAM||YES||Non-transactional engine with good performance and small data footprint||NO||NO||NO|
|SEQUENCE||YES||Generated tables filled with sequential values||YES||NO||YES|
|InnoDB||DEFAULT||Supports transactions, row-level locking, foreign keys and encryption for tables||YES||YES||YES|
|Aria||YES||Crash-safe tables with MyISAM heritage||NO||NO||NO|
The SEQUENCE row has been added, since it is a plugin for MariaDB and MySQL does not have this functionality.
How to use sequence objects
Dynamically change the table names and assign sequences as follows
Examples from 0 to 6.
>SELECT seq FROM seq_0_to_6 0 1 2 3 4 5 6
The default is to increment by 1, but can be specified as follows
Example of increasing by 3.
>SELECT seq FROM seq_0_to_9_step_3 0 3 6 9
It is also possible to JOIN these virtual tables together and do other complex things.
This feature may have been added because MySQL does not have a feature like rowid in Oracle.