MySQL: is there something like an internal record identifier for each record in a MySQL table?

I am creating a spreadsheet application using MySQL as a repository, I need to identify records that are updated on the client side in order to save the changes.

Is there a way, for example, some kind of "internal record identifier" (internal, as used by the database engine itself) to uniquely identify records so that I can update the correct one?

Of course, the SELECT query can be used to identify the record, including all the fields in the table, but it is obvious that in most cases the flip returns multiple records.

IMPORTANT: the spreadsheet application is designed to work with ANY table, even with a very poorly designed one, without any keys, therefore solutions such as "define a field with a UNIQUE index and work with it" are not an option, the table structure can be extremely variable and does not matter.

Many thanks.

+3
source share
3 answers

AFAIK there is no such unique internal identifier (say, a simple string identifier).

, SELECT , n- LIMIT. , , mySQL. , .

phpMyAdmin, - mySQL. . , , :

UPDATE xyz set a = b WHERE 'fieldname'  = 'value' 
                       AND 'fieldname2' = 'value2' 
                       AND 'fieldname3' = 'value3' 
                       LIMIT 0,1;

..

, .

, - , . , , , , , .

+1

MySQL , , , . , , select LAST_INSERT_ID()

mysql

0

, MySQL ROWID, Oracle ( ). AUTO_INCREMENT .

0

Source: https://habr.com/ru/post/1732665/


All Articles