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 equipments_backup FROM equipments;
I get a syntax error:
"Last Error Message:near "INTO":syntax error".
sqlite does not support SELECT INTO.
The SELECT INTO statement is a query that allows you to create a new table and populate it with the result set of a SELECT statement . To add data to an existing table, see the INSERT INTO statement instead. SELECT INTO can be used when you are combining data from several tables or views into a new table.
To select data from an SQLite database, use the SELECT statement. When you use this statement, you specify which table/s to select data from, as well as the columns to return from the query. You can also provide extra criteria to further narrow down the data that is returned.
To select multiple columns from a table, simply separate the column names with commas! For example, this query selects two columns, name and birthdate , from the people table: SELECT name, birthdate FROM people; Sometimes, you may want to select all columns from a table.
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With