Working With TSQLQuery

From Lazarus wiki
Revision as of 01:39, 1 February 2008 by Kirkpatc (talk | contribs)
Jump to navigationJump to search

If 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.