gpt4 book ai didi

java - 自增主键

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:21:38 26 4
gpt4 key购买 nike

<分区>

我对自动增量有疑问,同时数字发生了变化并且没有保持我定义的增量。附上表格的代码和图片。

    // Table 3 creation (Coupon)
try {
java.sql.Statement stmt3 = conn.createStatement();
sql = "create table Coupon("
+ "ID bigint not null primary key generated always as identity(start with 1, increment by 1), "
+ "TITLE varchar(30) not null, "
+ "START_DATE DATE not null, "
+ "END_DATE DATE not null,"
+ "AMOUNT INTEGER not null,"
+ "TYPE varchar(10) not null,"
+ "MESSAGE varchar(30) not null,"
+ "PRICE double not null,"
+ "IMAGE varchar(200) not null)";
stmt3.executeUpdate(sql);
System.out.println("success:" + sql);
} catch (SQLException e) {
System.out.println(e.getMessage());
}

enter image description here

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