SQLite add Primary Key

前端 未结 11 2475
你的背包
你的背包 2020-11-28 06:07

I created a table in Sqlite by using the CREATE TABLE AS syntax to create a table based on a SELECT statement. Now this table has no primary key b

11条回答
  •  生来不讨喜
    2020-11-28 06:23

    You can do it like this:

    CREATE TABLE mytable (
    field1 text,
    field2 text,
    field3 integer,
    PRIMARY KEY (field1, field2)
    );
    

提交回复
热议问题