How to add multiple columns to a table in Postgres?

PostgresqlPgadmin

Postgresql Problem Overview


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

Postgresql Solutions


Solution 1 - Postgresql

Try this :

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

Solution 2 - Postgresql

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

detailed query where column_constraints are optional

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHickView Question on Stackoverflow
Solution 1 - PostgresqlErkan HaspulatView Answer on Stackoverflow
Solution 2 - PostgresqlRaM PrabUView Answer on Stackoverflow