ALTER TABLE ... ADD COLUMN

From SQLZOO
Revision as of 09:05, 18 July 2012 by Marek (Talk | contribs)

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

Add a column to a table

schema:scott

This is in the SQL standard ALTER TABLE The term COLUMN is optional.

DROP TABLE a
CREATE TABLE a(x INTEGER, y INTEGER);
INSERT INTO a VALUES (1,2);
ALTER TABLE a ADD COLUMN z INTEGER;
SELECT * FROM a;
ALTER TABLE a ADD z INTEGER;
SELECT * FROM a;
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense