Data manipulation on the Force.com platform
DML statements allow users to retrieve, insert, delete, and update sObject data in the Force.com database. Apex has a set of DML commands, as follows, which can take a single sObject or a list of sObjects:
insert
: This command is used to add records to the particular Force.com database object. The ID is automatically generated for a record while executing this command.update
: This command is used to update fields of an existing record in the Force.com database object. The update is based on the ID of the particular record.upsert
; Based on the ID field, this command can either insert or update the particular records. If the record has a value for the ID field, then the record will be updated, and if the record doesn't have a value for the ID field, the record will be inserted.delete
: This command is used to delete records from the Force.com database based on the ID of the record. If any record is adhered to cascade deleting (such as a master-detail...