NEXTVAL | Syntax: | NEXTVAL(Sequence) | Return value: | INTEGER | Function type: | Sequence function | |
|
|
The NEXTVAL() function generates and returns the next value in a SEQUENCE.
Synonym for "NEXT VALUE FOR sequence".
The NEXTVAL() function is available from MariaDB version 10.3.
MySQL does not support sequences and the function does not exist in this database. |
Example 1 |
|
select nextval(`my_sequence`) as result;
|
|
|
Example 2 |
|
select NEXT VALUE FOR `my_sequence` as result;
|
|
|
The examples were created with the MyWAY SQL manager: |
How to use the NEXTVAL() function in MariaDB databases |
In MariaDB the NEXTVAL() function is used to generate a new sequence value from a sequence object. A sequence is a database object that generates a set of unique values, typically used to generate primary key values in a table, and can be useful for generating unique identifiers for data. |
|
Further MySQL und MariaDB SQL Sequence functions |
|