Get the App
SLTechnology News&Howtos  ›  Database  › 

How to delete multi-table associations by MySQL

Shulou Source: shulou.com Published: 2022-05-31 15:59:45 11月05日 Update

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!

Tags: Relevance content articles success value interest multiple guys buddies data more knowledge acronyms industry information information channels channels references help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Redmi Docker Linux Huawei