Reputation: 67
sqlite> create table t
...> SELECT * FROM sqlite_master WHERE type='table' AND name='t';
Error: near "SELECT": syntax error
sqlite>
I'm trying to create a table called 't' in terminal. I'm getting the error. Maybe I'm missing somewhere?
Upvotes: 1
Views: 72
Reputation: 521289
The syntax you need to use here is CREATE TABLE AS ... SELECT
:
> CREATE TABLE t AS SELECT * FROM sqlite_master WHERE type = 'table' AND name = 't';
Upvotes: 1