1
votes

I'm designing a SQL table that should hold the client data.

The client data is exported from another system and already contains a client_ID that I need to integrate into my client table.

My question is: If I put an exported client_ID as a primary key and import the data, how should I auto increment the client_ID on consecutive table inserts by my system?

How should I eliminate the overlap of the client IDs?

2

2 Answers

2
votes

You could import all your data and then establish the next number of the autoincrement

ALTER TABLE CLIENT AUTO_INCREMENT = lastClientId;

Where you have to replace lastClientId for the last id imported

1
votes

If your client_ID field is AUTO_INCREMENT, then you don't need to do anything specific, next time you insert into that table, Mysql will automatically use the next value of the greatest existing client_ID.