How Linux can quickly modify the sql file in the specified ID

  
                

The sql.sql file in Linux system has a large number of data records, sometimes including ID records. Sometimes we need to replace these ID records. How to replace them quickly? Today, Xiaobian tells everyone how to solve this problem. .

Solution:

When a field in a database (such as ID) is an integer, then when the newly inserted data required from the current maximum of the total existing database The value is incremented by 1 to start the alignment.

The current production database has a maximum id of 150, so you need to start from 151 when you go online. Of course, you can use sequence auto increment.

Here is the manual modification of sql, save the following content to online.sql

insert into ct values(1, 'sss', 2, 4);

Insert into ct values(1, 'sss', 2, 4);

insert into ct values(1, 'sss', 2, 4);

insert into ct values(1 , 'sss', 2, 4);

insert into ct values(1, 'sss', 2, 4);

insert into ct values(1, 'sss', 2 , 4);

insert into ct values(1, 'sss', 2, 4);

Open files with vim

Execute the following command in command mode Get it

:let n=151

Copyright © Windows knowledge All Rights Reserved