Answer the question
In order to leave comments, you need to log in
In what cases it is necessary to add AUTO_INCREMENT when creating a table in a database?
Let's say I receive data via a third-party API in which there is already an id-shnik, but it is text. Do I need to add an INT (AUTO_INCREMENT) field, or can I use a text ID from json, taking into account the fact that I will need to make a selection from this table, and it is quite large.
Answer the question
In order to leave comments, you need to log in
There is little initial data, what kind of data do you get, where do you save it, etc.
what kind of text id (is it a numeric format in the form of a string or just a string hash), how do you insert data to yourself from api, etc.,
if you have a json id this string hash, then it’s better to create your id field in your table as an increment and store json id in the hash field
if json id can be cast to int then, in principle, you can take it as the basis of the primary key (and here, in principle, you can even add an increment, nothing bad will happen )
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question