MYSQL Delete removed from the multiplayer table

Source: Internet
Author: User
Tags mysql delete

Syntax 1,

Delete table_list_a from Table_list_b where bool_expression;

Removes a line of bool expression true from Delete_table_list_a.

Example:

1.

CREATE TABLE T1 (ID int);

CREATE TABLE T2 (ID int);

CREATE TABLE T3 (ID int);

2.

Insert into T1 (ID) VALUES (1), (4), (5), (100);

Insert into T2 (ID) VALUES (2), (6), (7), (100);

Insert into T3 (ID) VALUES (3), (8), (9), (100);

3.

4.

Delete t1,t2 from t1,t2,t3 where t1.id = T2. Id and t2.id = t3.id;

Syntax 2,

Delete from t1,t2 using (T1,T2,T3) where t1.id = T2. Id and t2.id = t3.id;

can also play the same role!

Summary: When searching for rows to be deleted, these statements use all three tables, but only the corresponding rows are removed from table T1 and table T2

MYSQL Delete removed from the multiplayer table

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.