如何在SQLite中创建序列?

时间:2022-02-21 05:33:01

I have created a table in sqlite. There are two fields: pk_categoryid,category_name. I want to enter only one value from the user side. So, how can I create a sequence?

我在sqlite中创建了一个表。有两个字段:pk_categoryid,category_name。我想从用户端只输入一个值。那么,我该如何创建一个序列呢?

2 个解决方案

#1


15  

If you mean that you want the primary key to be autogenerated, then look at AUTOINCREMENT when creating your table:

如果您想要自动生成主键,请在创建表时查看AUTOINCREMENT:

#2


9  

create table Categories (
    pk_categoryid integer primary key autoincrement, 
    category_name text
);

#1


15  

If you mean that you want the primary key to be autogenerated, then look at AUTOINCREMENT when creating your table:

如果您想要自动生成主键,请在创建表时查看AUTOINCREMENT:

#2


9  

create table Categories (
    pk_categoryid integer primary key autoincrement, 
    category_name text
);