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 but I would like to add one.
Executing ALTER TABLE table_name ADD PRIMARY KEY(col1, col2,...)
gives a syntax error "near PRIMARY"
Is there a way to add a primary key either during table creation or afterwards in Sqlite?
By "during creation" I mean during creation with CREATE TABLE AS
.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…