Hick
Hick

Reputation: 36394

How to add multiple columns to a table in Postgres?

How do I add multiple columns in one query statement in PostgreSQL using pgadmin3?

Upvotes: 184

Views: 110183

Answers (2)

RaM PrabU
RaM PrabU

Reputation: 445

ALTER TABLE  IF EXISTS  TABLEname 
add ADD  COLUMN   IF NOT EXISTS  column_name data_type  [column_constraint];

detailed query where column_constraints are optional

Upvotes: 0

Erkan Haspulat
Erkan Haspulat

Reputation: 12552

Try this :

ALTER TABLE table ADD COLUMN col1 int, ADD COLUMN col2 int;

Upvotes: 327

Related Questions