简体   繁体   中英

How to add 1 to existing column in a table

给定一个表列,例如“ RollNumber”,如何为所有行将RollNumber的值增加1?

Just update your table as:

UPDATE YourTable
SET RollNumber = RollNumber + 1;

step-1 : create sequence

CREATE SEQUENCE id START WITH 1 INCREMENT BY 1;

Step-2 : update :

update tableName set RollNumber = id.nextval;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM