> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/gridgain/gridgain-9/reference/sql/dml.md).

# Data Manipulation Language (DML)

Data manipulation language (DML) commands supported by GridGain 9: DELETE, INSERT, MERGE, and UPDATE, with their syntax and parameters.

This section walks you through all data manipulation language (DML) commands supported by GridGain 9.

## DELETE

Deletes data from a table.

```bnf
DELETE FROM qualified_table_name
  [ [ AS ] alias ]
  [ WHERE booleanExpression ]
  [ LIMIT count ]
```

### Parameters

* `alias` - an SQL alias for an expression or value.
* `booleanExpression` - an SQL expression that returns a boolean value. Only the records for which `TRUE` was returned will be deleted. If not specified, all records are deleted.
* `count` - the maximum number of rows to delete. Accepts an integer literal or a query parameter.

{% hint style="warning" %}
When more rows match the `WHERE` expression than are specified in the `LIMIT`, there is no guarantee for which matching rows are deleted. For example, if 8 rows match the query and the `LIMIT` is 3, any 3 of the matching rows will be deleted. The statement then returns the number of rows deleted.
{% endhint %}

```sql
DELETE FROM Person WHERE city = 'New York' LIMIT 3;
```

## INSERT

Inserts data into a table.

```bnf
INSERT INTO qualified_table_name [ column_list ] query
```

## MERGE

Merges data into a table.

```bnf
MERGE INTO qualified_table_name [ [ AS ] alias ]
  USING qualified_table_name ON booleanExpression
  [ WHEN MATCHED THEN UPDATE SET assign [, assign]... ]
  [ WHEN NOT MATCHED THEN INSERT VALUES ( value [, value]... ) ]
```

{% hint style="info" %}
At least of the `WHEN MATCHED` and `WHEN NOT MATCHED` clauses must be present.
{% endhint %}

### Parameters

* `alias` - an SQL alias for an expression or value.
* `booleanExpression` - an SQL expression that returns a boolean value. If `TRUE` is returned, the `WHEN MATCHED` clause is executed, otherwise the `WHEN NOT MATCHED` is executed.
* `value` - arbitrary value that will be inserted into the table during the operation.

## UPDATE

Updates data in a table.

```bnf
UPDATE qualified_table_name
  SET assign [, assign]...
  [ WHERE booleanExpression ]
```

### Parameters

* `booleanExpression` - an SQL expression that returns a boolean value. Only the records for which `TRUE` was returned will be updated. If not specified, all records will be updated.
