Thanks for sharing, but what would be the approach when the ID column is of type string ?
ID
string
Hi Andrei, first off, thanks for reading the article. If you are concerned that DBMS might order by ID in a different way than what you expect.
In that case you can always go for custom collation. dev.mysql.com/doc/refman/5.6/en/ad....
A collation basically is set of rules used by DBMS to compare & sort strings. It is much like a comparator function you are used to in JS.
This way you can make your comparisons predictable & inline with your business needs.
Thank you very much!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for sharing, but what would be the approach when the
ID
column is of typestring
?Hi Andrei, first off, thanks for reading the article. If you are concerned that DBMS might order by
ID
in a different way than what you expect.In that case you can always go for custom collation. dev.mysql.com/doc/refman/5.6/en/ad....
A collation basically is set of rules used by DBMS to compare & sort strings. It is much like a comparator function you are used to in JS.
This way you can make your comparisons predictable & inline with your business needs.
Thank you very much!