---
title: "Data manipulation statements (DML)"
description: "Overview of the CoraDB statements that read and change data: SELECT, WITH, INSERT, UPDATE, REPLACE, DELETE, MERGE and TRUNCATE."
url: "https://www.coradb.ai/manual/sql/query.html"
markdown_url: "https://www.coradb.ai/manual/markdown/sql/query.md"
product: "CoraDB"
version: "1.0"
keywords: "dml, data manipulation language, sql statements, select insert update delete, merge, truncate, coradb sql"
---

# Data manipulation statements (DML)

Data manipulation statements read and change the rows stored in tables. In CoraDB they work on relational tables and on the vertex and edge tables of a graph alike; graph data can also be queried with [MATCH](https://www.coradb.ai/manual/graph/match.html) patterns inside a `SELECT`.

All examples in this section use the [e-commerce sample database](https://www.coradb.ai/manual/sample-database.html).

## Reading data

| Statement | What it does |
|---|---|
| [SELECT](https://www.coradb.ai/manual/sql/query/select.html) | Returns rows from tables, views, subqueries and graph patterns. |
| [WITH (CTE)](https://www.coradb.ai/manual/sql/query/cte.html) | Names intermediate results for one statement; `WITH RECURSIVE` builds rows step by step. |
| [Hierarchical queries](https://www.coradb.ai/manual/sql/query/hq.html) | Walks tree-structured data with `START WITH ... CONNECT BY`. |

## Changing data

| Statement | What it does |
|---|---|
| [INSERT](https://www.coradb.ai/manual/sql/query/insert.html) | Adds rows from values or a query; `ON DUPLICATE KEY UPDATE` turns a conflicting insert into an update. `INSERT VERTEX` and `INSERT EDGE` add graph data. |
| [UPDATE](https://www.coradb.ai/manual/sql/query/update.html) | Changes column values in one table or, through a join, in several tables. |
| [REPLACE](https://www.coradb.ai/manual/sql/query/replace.html) | Inserts rows, first deleting any existing row with the same primary key or unique value. |
| [DELETE](https://www.coradb.ai/manual/sql/query/delete.html) | Removes the rows that match a condition, from one or several tables. |
| [MERGE](https://www.coradb.ai/manual/sql/query/merge.html) | Updates, deletes or inserts target rows depending on whether they match a source. |
| [TRUNCATE](https://www.coradb.ai/manual/sql/query/truncate.html) | Removes every row of a table and resets its `AUTO_INCREMENT` counter. |

## Other statements

| Statement | What it does |
|---|---|
| [PREPARE, EXECUTE, DEALLOCATE](https://www.coradb.ai/manual/sql/query/prepare.html) | Compiles a statement once and runs it with different parameter values. |
| [DO](https://www.coradb.ai/manual/sql/query/do.html) | Evaluates an expression without returning a result. |

Changes made by these statements become permanent when the transaction commits. See [Transactions](https://www.coradb.ai/manual/sql/transaction.html) for commit, rollback and isolation levels.
