Alter a table column with auto increment by 1 in derby

后端 未结 7 1527
囚心锁ツ
囚心锁ツ 2021-01-11 18:21

I have created a table in derby Netbeans and now i realize that i need to make a column as auto incremented by 1 which is a primary key. How can i do so? I

7条回答
  •  礼貌的吻别
    2021-01-11 18:50

    Recreate the table again see example below:

    CREATE TABLE students
    (
    id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
    name VARCHAR(24) NOT NULL,
    address VARCHAR(1024),
    CONSTRAINT primary_key PRIMARY KEY (id)
    ) ;
    

提交回复
热议问题