Can I alter a column in an sqlite table to AUTOINCREMENT after creation?

后端 未结 11 1837
野趣味
野趣味 2020-12-13 13:08

Can I make a field AUTOINCREMENT after made a table? For example, if you create a table like this:

create table person(id integer primary key, n         


        
11条回答
  •  猫巷女王i
    2020-12-13 13:53

    You can do it with SQLite Expert Personal 4:

    1) Select the table and then go to "Design" tab > "Columns" tab.

    2) Click "Add" and select the new column name, and type INTEGER and Not Null > Ok.

    3) Go to "Primary Key" tab in "Desgin tab". Click "Add" and select the column you just created. Check the "Autoincrement" box.

    4) Click "Apply" on the right bottom part of the window.

    If you go back to the "Data" tab, you will see your new column with the autogenerated numbers in it.

提交回复
热议问题