I want create table from another table with constraint?
I used this query “create table destination as select * from source;” fro table creation.
But its copy only the column name in table without column constraint.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is a special table named
sqlite_master, holding the fullCREATE TABLEstatement for each table (it’s modified as appropriate duringALTER TABLE).I would make my application retrieve that
CREATE TABLEstatement:Then I would replace the table name right after
CREATE TABLEtokens, and execute the result as a new sqlite query.I don’t think that it’s possible to do in sqlite’s pure SQL without extensions.