How to delete multi-table associations by MySQL
This article mainly introduces MySQL how to delete multi-table association, the article is very detailed, has a certain reference value, interested friends must read it!
In MySQL, to delete multiple associated tables, you can use the following SQL
Mysql > delete e, d from emp e inner join dept d on e.deptno=d.deptno where e.deptno=10
Query OK, 4 rows affected (0.01sec)
The e and d after delete is the abbreviation of the table.
After successful execution, the corresponding data in the two tables will be deleted
Mysql > select * from dept
+-+
| | deptno | dname | loc | |
+-+
| | 20 | RESEARCH | DALLAS |
| | 30 | SALES | CHICAGO |
| | 40 | OPERATIONS | BOSTON |
| | 50 | Research | BeiJing |
+-+
4 rows in set (0.00 sec)
Mysql > select * from emp where deptno=10
Empty set (0.00 sec)
The above is all the contents of the article "how to delete multi-table associations in MySQL". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!