How to use the sequence object introduced in MariaDB 10.0.3
Version
| Version |
|---|
| 10.3.36-MariaDB |
Sequence storage engine confirmation
Sequence storage engine has been added since MariaDB 10.0.3.
SHOW engines;
| Engine | Support | Comment | Transactions | XA | Savepoints |
|---|---|---|---|---|---|
| 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 |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
The SEQUENCE row has been added, since it is a plugin for MariaDB and MySQL does not have this functionality.
Attention Required! | Cloudflare
How to use sequence objects
Dynamically change the table names and assign sequences as follows
seq_[FROM]_to_[TO]
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
seq_[FROM]to[TO]step[STEP]
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.



コメント