Outdated Version

You are viewing an older version of this section. View current production version.

DELETE

Deletes data from a table.

Syntax

DELETE FROM tbl_name
    [WHERE expr]
    [LIMIT row_count]

Remarks

  • row_count - maximum row count limit.
  • DELETE queries may fail if the maximum_memory limit has been reached.
  • This command must be run on the master aggregator or a child aggregator node (see Node Requirements for MemSQL Commands).
  • MemSQL does not yet fully support multi-table DELETE statements. Subqueries in the WHERE clause are the only multi-table DELETE allowed.
  • Writing to multiple databases in a transaction is not supported.

Example

memsql> DELETE FROM mytbl WHERE seq=1;
Query OK, 3 rows affected (0.04 sec)

memsql> DELETE FROM mytbl WHERE id IN (SELECT id from myother) LIMIT 10;
Query OK, 10 rows affected (0.02 sec)