picoSQL - Language reference manual


ALTER TABLE


Syntax:

Format 1:

ALTER TABLE table-name RENAME new-table-name

Format 2:

ALTER TABLE table-name ADD [COLUMN] column-name data-definition

Format 3:

ALTER TABLE table-name DROP [COLUMN] column-name


Purpose:

Allows to modify a table definition.


See also:

CREATE TABLE, DROP INDEX


Description:



This command changes table structure without modifying the content.

Format 1 allows to change the table name.

Format 2 allows to add a new column to a table. The column is appended at the end of the row. If the table already has some rows, new column will be initialized to NULL.
Column name must be univoque in the table. COLUMN clause has no effects.

Format 3 allows to drop a column from a table. The column to drop can contain data and in such case, this data are lost. The column to drop cannot be part of an index; in this case you need to drop the index before and then the column.


Index Previous Next