---
schema_version: "1"
id: b87af6f2f28970be16d04a6f5bfbb37d71473f6dc8981d6b6a275e0fd24a5d5b
title: DML Operations
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/langCon_apex_dml_operations.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_operations.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 9623e5746bc58fde8e92a94c8dcce2ac54ac9fa8cbb6dafb892abdeedb2b6f11
description: Using DML, you can insert new records and commit them to the database. You can also update the field values of existing records.
---
# DML Operations

Using DML, you can insert new records and commit them to the database. You can also update the field values of existing records.

- **[Inserting and Updating Records](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_examples_insert_update.htm)**  
    Using DML, you can insert new records and commit them to the database. Similarly, you can update the field values of existing records.
- **[Upserting Records](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_examples_upsert.htm)**
- **[Merging Records](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_examples_merge.htm)**  
    When you have duplicate lead, contact, case, or account records in the database, cleaning up your data and consolidating the records is a good idea. You can merge up to three records of the same sObject type. The merge operation merges the duplicate records into the main record, deletes the duplicate records, and reparents any related records.
- **[Deleting Records](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_examples_delete.htm)**
- **[Restoring Deleted Records](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_examples_undelete.htm)**
- **[Converting Leads](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_examples_convertlead.htm)**