The DELETE statement is used to remove records from a database table. Its syntax is similar to SELECT. Selection criteria must be carefully specified to avoid deleting unintended records.
Example 1: Deleting All Records
SQLCommand = "DELETE FROM personen"
- This command deletes all records from the personen table and should generally be avoided unless you really want to clear the entire table.
Example 2: Deleting a Specific Record
SQLCommand = "DELETE FROM personen WHERE personalnummer = 4711"
- This command deletes exactly one record, since it filters by the unique indexed field personalnummer (personnel number).