SQLite Forum

Are Views just stored SQL Strings or something more?
Login
Presumably you mean CREATE TABLE ... AS \<query>

This is SYNTACTIC SUGAR (the same thing but sweeter) as:

CREATE TABLE ...;  
INSERT INTO \<table> \<query>;  

That is, instead of running the two statements:

CREATE TABLE t1 (i);  
INSERT INTO t1 SELECT i FROM t0;  

you can say in one statement (with suger on top):

CREATE TABLE t1 AS SELECT i FROM t0;

This creates a new table t1 from the contents of table t0 at the instant in time at which the statement is executed.  Subsequent changes to t0 ARE NOT reflected in t1.

Contrast with:

CREATE VIEW t1 AS SELECT i FROM t0;

where the contents of t1 represent the contents of t0 at the time the view is used and changes to t0 are reflected in view t1.