开发者

How to add Primary Key from Existing table in SQLite?

开发者 https://www.devze.com 2023-01-20 19:09 出处:网络
Now i am working in SQLite database. I want to add primary key from my existing table. But i couldn\'t add the primary key in existing table and i have deleted all the records in the old table. So how

Now i am working in SQLite database. I want to add primary key from my existing table. But i couldn't add the primary key in existing table and i have deleted all the records in the old table. So how can i add the primary key from existing table in SQLite?

Here my query is,

        alter table studetails add constraint pk primary key (rollno).

I have used that above query, but it shown error开发者_开发问答. Is it possible?, if yes, please guide me.

Thanks!


you cannot according to SQLite's syntax perform this operation. In general it seems strange to add a primary key to an existing table. This should be done using the create table statement (you can also add an index by create index).

Br Anders

Alter table in SQLite
Create table in SQLite

0

精彩评论

暂无评论...
验证码 换一张
取 消