1, the raw data table
2, the operation
-- 创建序列 test_data_file_Id_Seq --
create sequence Test_data_file_Id_Seq
increment by 1
start with
minvalue 1
maxvalue 999999999;
- on the table you want to add a backup increment id's to prevent operating errors
create table test_data_file_copy as select * from test_data_file
- The number of records in the table to see if the backup is consistent with previous table
the SELECT COUNT (*) from test_data_file_copy
the SELECT * from test_data_file_copy
- Added an ID field, to set this field to prepare for the following increment fields, special attention is needed: if there is no empty field ready for us as increment of property, we need to first create a field, the following code:
ALTER Table test_data_file_copy the Add int Id
- Set the id field is a field of the table of the self-energizing action sequence,
Update test_data_file_copy SET id = Test_data_file_Id_Seq.nextval --Test_data_file_Id_Seq.nextval this meanings:
- inserting data test to see whether the increment id role
insert into test_data_file_copy values ( 'shijiazhuang', 'postpaid', 'huawei9999', 'Huawei', 20,666,11, '238.3800000000', 'GSM', ' a', 'a', 'a', 'a', 'a' , 666,7, -1, -1,66,0,66.66,0.66,0.66, Test_data_file_Id_Seq.nextval )
May be the last line of data query by rownum, it has successfully played the role of friends