Reputation: 4927
I am using sqlite3.
Suppose I have a view view_intermediate
. I would like to create a temporary table from this view. In other words, turn the result of the view into a temporary table.
How should the SQL statement look like to do this?
Upvotes: 1
Views: 126
Reputation: 1801
SQLite supports CREATE TABLE AS..SELECT
, so assuming you want the data in the table:
CREATE TABLE myTable AS
SELECT *
FROM view_intermediate;
If you want a table to be created from the view, but don't want the data, you can add a false condition.
CREATE TABLE myTable AS
SELECT *
FROM view_intermediate
WHERE 1=2;
Upvotes: 4