[mysql] delete
Single-table syntax:
DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name
[WHERE where_condition]
[ORDER BY ...]
[LIMIT row_count]
Multiple-table syntax:
DELETE [LOW_PRIORITY] [QUICK] [IGNORE]
tbl_name[.*] [, tbl_name[.*]] ...
FROM table_references
[WHERE where_condition]
Or:
DELETE [LOW_PRIORITY] [QUICK] [IGNORE]
FROM tbl_name[.*] [, tbl_name[.*]] ...
USING table_references
[WHERE where_condition]
> select * from topic;
+----+------------+-------------------+---------------------+----------+----------+
| id | title | description | created | author | profile |
+----+------------+-------------------+---------------------+----------+----------+
| 1 | MySQL | MySQL is... | 2018-01-01 12:10:11 | egoing | NULL |
| 2 | Oracle | Oracle is .... | 2018-01-03 13:01:10 | Kio | NULL |
| 3 | SQL Server | SQL Server is ... | 2018-01-20 11:01:10 | kiostory | NULL |
| 4 | PostgreSQL | PostgreSQL is ... | 2018-01-23 01:03:03 | freebee | NULL |
| 5 | MongoDB | MongoDB is ... | 2018-01-30 12:31:03 | cookieg | NULL |
| 6 | CUBRID | CUBRID is ... | 2019-02-25 14:14:34 | kio | I am me. |
+----+------------+-------------------+---------------------+----------+----------+
6 rows in set (0.0076 sec)
> delete from topic where id=6;
Query OK, 1 row affected (0.0107 sec)
> select * from topic;
+----+------------+-------------------+---------------------+----------+---------+
| id | title | description | created | author | profile |
+----+------------+-------------------+---------------------+----------+---------+
| 1 | MySQL | MySQL is... | 2018-01-01 12:10:11 | egoing | NULL |
| 2 | Oracle | Oracle is .... | 2018-01-03 13:01:10 | Kio | NULL |
| 3 | SQL Server | SQL Server is ... | 2018-01-20 11:01:10 | kiostory | NULL |
| 4 | PostgreSQL | PostgreSQL is ... | 2018-01-23 01:03:03 | freebee | NULL |
| 5 | MongoDB | MongoDB is ... | 2018-01-30 12:31:03 | cookieg | NULL |
+----+------------+-------------------+---------------------+----------+---------+
5 rows in set (0.0076 sec)