THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||
---|---|---|
| ||
CREATE TABLE Person (id INT, name VARCHAR(32), lastname VARCHAR(32), taxid int); ALTER TABLE Person ADD COLUM NCOLUMN residence VARCHAR(2) DEFAULT "GB"; ALTER TABLE Person DROP COLUMN lastname, taxid; ALTER TABLE Person ADD COLUMN lastname DEFAULT "N/A"; |
This sequence of modifications will result in the following schema history
ID | Columns | Delta |
---|---|---|
1 | id, name, lastname, taxid | N/A |
2 | id, name, lastname, taxid, residence | + residence ("GB") |
3 | id, name, residence | -lastname, -taxid |
4 | id, name, residence, lastname | +lastname ("N/A") |
With this history, upgrading a tuple (1, "John", "Doe") of version 1 to version 4 means erasing columns lastname and taxid and adding columns residence with default "GB" and lastname (the column is returned back) with default "N/A" resulting in tuple (1, "John", "GB", "N/A").
...