开发者

SELECT INTO statement in sqlite

Does sqlite support the SELECT INTO statement?

Actually I am trying to save the data in table1 into table2 as a backup of my database before modifying the data.

When I try using the SELECT INTO statement:

SELECT * INTO equipm开发者_如何学运维ents_backup FROM equipments;

I get a syntax error:

"Last Error Message:near "INTO":syntax error".


Instead of

SELECT * INTO equipments_backup FROM equipments

try

CREATE TABLE equipments_backup AS SELECT * FROM equipments


sqlite does not support SELECT INTO.

You can probably use this form instead:

INSERT INTO equipments_backup SELECT * FROM equipments;


SQlite didn't have INSERT INTO syntax.

In 2019, I use TEMPORARY keyword to create temporary table and INSERT data to temp table:

CREATE TEMPORARY TABLE equipments_backup(field1 TEXT, field2 REAL)
INSERT INTO equipments_backup SELECT field1, field2 FROM equipments
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜