ALTER TABLE ... ADD COLUMN

From SQLZOO
Revision as of 15:35, 12 July 2012 by Marek (Talk | contribs) (Created page with "Add a column to a table <div class='ht'> <div class=params>schema:scott</div> <div> Naturally, all of the data in the table is lost when the table is dropped. Foreign Key ref...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Add a column to a table

schema:scott

Naturally, all of the data in the table is lost when the table is dropped.

Foreign Key references can cause problems.

DROP TABLE a
CREATE TABLE a(x INTEGER, y INTEGER);
INSERT INTO a VALUES (1,2);
ALTER TABLE a ADD COLUMN z INTEGER
ALTER TABLE a ADD z INTEGER