I have a table Persons with columns PersonId, FirstName, DeptId and City. The PersonId is a Primary Key.
By default on first insert, I want the first entry for the DeptId to have a value of 3000. And the subsequent entries should always increment on the last value of DeptId.
Can someone please help me with that in MySQL ?
1 John 3000 Port Mathurin
2 James 3001 Port Desny
insert into `Persons` (`PersonID`, `FirstName`, `DeptId`, `City`) VALUES (1, 'Job', select `DeptId` from `Persons` +1, 'Port Mathurin)