gpt4 book ai didi

sql - 自动递增 ID 值

转载 作者:行者123 更新时间:2023-12-04 16:42:00 25 4
gpt4 key购买 nike

我有一个带有生成 ID 的 HSQLDB 数据库,我希望自动递增的值始终高于 100,000。这可能与 HSQLDB 吗?任何数据库都可以做到这一点吗?

最佳答案

根据HSQL Documentation :

Since 1.7.2, the SQL standard syntax is used by default, which allows the initial value to be specified. The supported form is( INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH n, [INCREMENT BY m])PRIMARY KEY, ...). Support has also been added for BIGINT identity columns. As a result, an IDENTITY column is simply an INTEGER or BIGINT column with its default value generated by a sequence generator.



...

The next IDENTITY value to be used can be set with the

ALTER TABLE <table name> ALTER COLUMN <column name> RESTART WITH <new value>;

关于sql - 自动递增 ID 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/491777/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com