(Contents)(Previous)(Next)

Updating Column Definitions

The table definition can be altered while the database is operative.

The following statement inserts two further columns into the table 'person'. First these columns contain the NULL value in each row.

ALTER TABLE person

ADD (phone FIXED(8),

city CHAR(10))

The new columns are immediately available for the processing:

UPDATE person SET phone = 670900, city = 'Los Angeles'

WHERE name = 'Brand'

SELECT cno, firstname, name, city, account, phone

FROM person

In a similar way, columns or integrity rules can be removed. The column 'account' is to be dropped from the table:

ALTER TABLE person DROP (account)

Beyond this, column definitions can be altered. The new definition will only be executed if the values that are already stored correspond to it. The column 'name', for example, can be extended from a length of 8 to a length of 10 characters:

ALTER TABLE person COLUMN name CHAR (10)


(Contents)(Previous)(Next)