In rendition 10.0.3, MariaDB presented a capacity motor known as succession. Its impromptu produces a number grouping for activities, and afterward it ends. The arrangement contains positive whole numbers in slipping or climbing request, and uses a beginning, finishing, and augmentation esteem.
It doesn't permit use in various inquiries, just in its unique inquiry due to its virtual (not written to circle) nature. Notwithstanding, grouping tables can be changed over to standard tables through an ALTER order. In the event that a changed over table is erased, the arrangement table actually exists. Groupings additionally can't create negative numbers or pivot at the base/most extreme.
Installing the Sequence Engine
Utilizing successions requires introducing the arrangement motor, which MariaDB circulates as a module instead of double. Introduce it with the accompanying order −
INSTALL SONAME "ha_sequence";
After establishment, check it −
Recollect that after motor establishment, you can't make a standard table with a name that utilizations arrangement sentence structure, however you can make a brief table with a succession grammar name.
There are two techniques for succession creation −
- Make a table and utilize the AUTO_INCREMENT quality to characterize a segment as auto-increase.
- Utilize a current data set and utilize an arrangement SELECT question to create a succession. The question utilizes seq_ [FROM] _to_[TO] or seq_[FROM]_to_[TO]_step_STEP sentence structure.
Best practices lean toward the utilization of the subsequent technique. Audit an illustration of a grouping creation given underneath −
SELECT * FROM seq_77_to_99;
Successions have numerous utilizations −
Find missing qualities inside a segment to ensure against related issues in tasks −
SELECT myseq.seq FROM seq_22_to_28 myseq LEFT JOIN table1 t ON myseq.seq = x.y WHERE x.y IS NULL;
Build a mix of qualities −
SELECT x1.seq, x2.seq FROM seq_5_to_9 x1 JOIN seq_5_to_9 x2 ORDER BY 5, 6;
Discover products of a number −
SELECT seq FROM seq_3_to_100_step_4;
- Build a date arrangement for use in applications like booking frameworks.
- Build a period succession.