How to Add Multiple Columns to a Table in Postgres?

How to Add Multiple Columns to a Table in Postgres?

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

2 Answers

Try this :

ALTER TABLE table ADD COLUMN col1 int, ADD COLUMN col2 int;
2
ALTER TABLE  IF EXISTS  TABLEname 
add ADD  COLUMN   IF NOT EXISTS  column_name data_type  [column_constraint];

detailed query where column_constraints are optional

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Alexander Ross
Author

Alexander Ross

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.