In this article, we will sse how to add or delete a column in PostgreSQL table step by step.
In some cases it is required to add column to a table or delete a column from table once it is created.
Add a column to PostgreSQL table
We can add or remove the columns from a table using alter statement.
1) Add column to postgresql table:
Syntax to add column:
alter table table_name add column_name datatype
alter table students add email varchar(60);
2) Delete/drop column from postgresql table:
Syntax to drop column:
alter table table_name delete column_name
alter table students delete email;
For the same please watch below video: