DELETE

Description

DELETE statement removes rows from a table.

Syntax

Single-Table Syntax

  1. DELETE FROM tbl_name [[AS] tbl_alias]
  2. [WHERE where_condition]
  3. [ORDER BY ...]
  4. [LIMIT row_count]

The DELETE statement deletes rows from tbl_name and returns the number of deleted rows.

Explanations

  • The conditions in the optional WHERE clause identify which rows to delete. With no WHERE clause, all rows are deleted.
  • If the ORDER BY clause is specified, the rows are deleted in the order that is specified. -The LIMIT clause places a limit on the number of rows that can be deleted.

Examples

  • Single-Table Examples
  1. > CREATE TABLE t1 (a bigint(3), b bigint(5) primary key);
  2. > insert INTO t1 VALUES (1,1),(1,2);
  3. > delete from t1 where a=1 limit 1;
  4. > select * from t1;
  5. +------+------+
  6. | a | b |
  7. +------+------+
  8. | 1 | 2 |
  9. +------+------+

Constraints

MatrixOne doesn’t support deleting multiple-table.