ALTER TABLE — Modify an existing table
new_table_name; ALTER TABLE
TABLE command modifies an existing table without
performing a full dump and reload of the data. The SQLite
supports two basic operations. The
RENAME variant is used to change the name of a
ADD COLUMN is
used to add a new column to an existing table. Both versions of
ALTER TABLE command will
retain any existing data in the table.
RENAME variant is used to “move” or rename an existing table. An
TABLE...RENAME command can only modify a
table in place, it cannot be used to move a table to
another database. A database name can be provided when
specifying the original table name, but only the table
name should be given when specifying the new table
Indexes and triggers associated with the table will remain with the table under the new name. If foreign key support is enabled, any foreign keys that reference this table will also be updated.
View definitions and trigger statements that reference the table by name will not be modified. These statements must be dropped and recreated, or a replacement table must be created.
ADD COLUMN variant is used to add a new column to the end of a table definition. New columns must ...