DELETE FROM

Deletes rows that match the WHERE clause, from the table.

Note

The changes of the table state can’t be tracked within a single transaction. If the table has already been changed, use DELETE ON to delete the data within the same transaction.

Example

  1. DELETE FROM my_table
  2. WHERE Key1 == 1 AND Key2 >= "One";
  3. COMMIT;

DELETE - 图1

DELETE FROM … ON

Used to delete the data, if the table has already been changed within the same transaction.

Example

  1. $to_delete = (
  2. SELECT Key, SubKey FROM my_table WHERE Value = "ToDelete"
  3. );
  4. SELECT * FROM my_table;
  5. DELETE FROM my_table ON
  6. SELECT * FROM $to_delete;
  7. COMMIT;

DELETE - 图2