mysql---multi table delete(删除多个表)

-- remove only the employees
DELETE e
FROM Employees e JOIN Department d ON e.department_id = d.department_id
WHERE d.name = Sales;


-- remove employees and department
DELETE e, d
FROM Employees e JOIN Department d ON e.department_id = d.department_id
WHERE d.name = Sales;


-- remove from all tables (in this case same as previous)
DELETE
FROM Employees e JOIN Department d ON e.department_id = d.department_id
WHERE d.name = Sales;

【注】

基本删除语法:

DELETE FROM Employees;

 

mysql---multi table delete(删除多个表)

上一篇:Django下从sqlite3切换到mysql需要做的操作


下一篇:MYSQL 命令行显示乱码 解决方案