Create constrained table from another table in sqlite?
1 answer
There is a special table named sqlite_master
that contains the complete statement CREATE TABLE
for each table (it has been modified as needed in ALTER TABLE
).
I would make an application for this operator CREATE TABLE
:
SELECT sql FROM sqlite_master WHERE type='table' AND name='source';
Then I would replace the table name right after the tokens CREATE TABLE
and execute the result as a new sqlite query.
I don't think it can be done in sqlite pure SQL without extensions.
+4
source to share