I have a database with multiple tables. I want to add a new column to each one of them and fill these column 开发者_JAVA百科with some constant integer value. My search on google did not give me desired answer.
I am using PostgreSQL and PHP.
Can't you use ALTER TABLE to create a new column and SET DEFAULT to set the default value to all column fields?
Like:
ALTER TABLE mytable ADD COLUMN mynumber integer; ALTER mynumber SET DEFAULT 7
(http://www.postgresql.org/docs/8.2/static/sql-altertable.html)
精彩评论