Hello, I'm a beginner at coding.
When I deleted the value in the middle of the SQL syntax while studying the database, I thought the default key would be sorted on its own, but the default key remained the same as before.
For example, if you delete data number 3 with the default key of 1,2,3,4,5,6 respectively, the default key of the remaining data remains 1,2,4,5,6.
I want to automatically sort these basic keys in order like 1, 2, 3, 4, 5, but I can't find a way to search on the Internet, so I'm asking you a question.
If this is the case, is there any other way than deleting the data and reloading the default key from scratch?
I'd appreciate it if you could answer.
sql delete primary-key database
Yes. I don't know why you need to rearrange, but PK key is the only value, so there should be no change.
First of all, if you think you can change the default key, you can't do .At the level of the database, the data in 3
must/have existed only once in human history, can only be generated once, and can only be deleted once. If that doesn't work, history distortion will occur regarding what was the data of 3
or whether there was such a thing. Be sure to understand the concepts of unity, minimality, etc. .
Anyway, what you want to do is eventually to rank the default keys in ascending order It's a different concept that has nothing to do with the basic key. If it's MySQL, you can do it like this.
SELECT
(@row_number := @row_number + 1) AS rnum,
t.PK, foo, t.bar
FROM table t,
(SELECT @row_number := 0) as X
ORDER BY t.PK
573 Understanding How to Configure Google API Key
891 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
568 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
610 Uncaught (inpromise) Error on Electron: An object could not be cloned
600 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.