I am using PostgreSQL. So, I have already filled sql table with user_id and user balance. I want to add a new column with rating. The default rating must be filled with fives.
From such table state
user_id | balance |
---|---|
2000000001 | 50 |
187638781 | 110 |
I need to get this
user_id | balance | rating |
---|---|---|
2000000001 | 50 | 5 |
187638781 | 110 | 5 |
What's the best way for this?
CodePudding user response:
Alter the table (here, named test1) to add the column with the default:
alter table test1 add column rating int default 5;