It is possible, but not recommended. To do this would have to change the id
and that’s something you shouldn’t do, you’d have to change the id
of several other data lines, and in a certain scenario of all. And then all references to these data would be invalid. It would have to change in every database, application, or anything external that has picked up this reference by id
. So don’t do it, let it be good.
Note that you cannot organize how the database puts information inside it, it is not your interest, it is implementation detail and it can change as you wish.
What I think you’re thinking is that this data is organized the way you see it. This is just a presentation, an application that shows data, she decided it would show like this, she must have other ways of showing it in other ways.
You can have it shown differently right there or elsewhere. This presentation probably came from a query SQL, and what you’re describing would have to do something like:
SELECT FROM Produtos ORDER BY stProduto
I kicked the name of the table. Ready, is presenting the way you want. But no reallocation was made. To reallocate could make a script classification (Sort) that record the data and not only present it, but have all the problems I said before.
The need to put everything together doesn’t make sense and it’s not how a database works. The will to do this must happen either by not knowing the nature of the database or by having OCD, which I understand, but should not yet do, not being the first.
Of course if the table has just been created and there is no reference to it anywhere inside or outside the database would even do that Sort to meet this taste, but always something like this will occur and can not do the other times, so better not waste time, focus on the presentation.
It’s not just ordering from the field
stProduto
or I didn’t understand your doubt?– anonimo
but the problem that is already at the base, and that basis it points to a product site and I needed that last product to stay together with his segment of toilet paper
– Lucas Lira
It seems to me, since you have not provided the proper information, that the field
id
It’s kind of self-improvement. Whoever created the database used this type of field (artificial key) so as not to worry about any specific order of record storage. Incidentally in any DBMS if you want to ensure data recovery in any particular order should always use the clauseORDER BY
.– anonimo