Working With TSQLQuery
From Lazarus wiki
Jump to navigationJump to searchIf you need to be able to DELETE or otherwise modify records, your database table should contain one PRIMARY KEY column that has the property AUTO_INCREMENT. This enables the DELETE method to identify the records marked for deletion in the 'WHERE' clause written back to the database. The primary key field should preferably be designed into the table structure at CREATE time, but can be added using the following example code in your MySQL client:
alter table testrig add column autoid int primary key auto_increment;
The code can, of course, be written on one line but has been broken up for clarity.