0
ALTER TABLE a add (OWNER_NAME VARCHAR2,OWNER_PARENT VARCHAR2);

Is it possible to alter table add MULTIPLE columns in a single statement in sqlite3?

1 Answer 1

1

The SQLite documentation provides the following picture to illustrate how the ALTER TABLE is understood by SQLite.

enter image description here

So, it does not seem possible to add multiple columns in a single ALTER TABLE command.

Reference: SQLite Query Language: ALTER TABLE

EDIT:

SQLite is a bit rigid when it comes to modifying existing tables and has limited support for the ALTER TABLE query.

Some more information can be found following this link: How do I add or delete columns from an existing table in SQLite.

The link also provides a workaround to carry out complex table modifications.

In a nutshell (emphasis mine):

If you want to make more complex changes in the structure of a table, you will have to recreate the table. You can save existing data to a temporary table, drop the old table, create the new table, then copy the data back in from the temporary table.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.