In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Mysql multi-table deletion
Delete all the grades of a student while deleting the basic information of the student
Mysql > select * from stu_inf +-- +-+ | id | stu_xh | stu_xm | xb_id | xy_id | stu_bj | + -+ | 1 | 07150101 | Xiao Ming | 1 | 1 | 1504 | | 2 | 07150240 | Xie Yuzheng | 1 | 2 | 1502 | 3 | 12341231 | Monkey | 1 | 2 | 1515 | 4 | 01591261 | Da | 1 | 3 | 1515 | 5 | 07160202 | Xiao Hong | 2 | 4 | 1602 | 6 | 07150225 | Yellow River | 1 | 3 | 1315 | 7 | | | 01050001 | Huarong | 1 | 7 | 1612 | | 8 | 02050002 | Huang Yueying | 2 | 8 | 1608 | 9 | 01510003 | Huanhuan | 2 | 9 | 1601 | | 10 | 05261005 | Dakang | 1 | 10 | 1304 | 13 | 0001 | xxx | 1 | 2 | 1555 | + -+ 11 rows in set (0.02 sec) mysql > select * from cj_inf +-+ | cj_id | cj_stuid | cj_kmid | cj_score | +-+ | 1 | 3 | 1 | 87 | | 2 | 1 | 2 | 65 | | 3 | 4 | 1 | 77 | | 5 | 3 | 9 | 76 | 7 | 1 | 1 | 90 | 15 | 13 | 9 | 90 | 16 | 13 | 8 | 67 | 13 | 13 | 1 | | 88 | +-+ 8 rows in set (0.02 sec) |
Delete statement:
Mysql > DELETE stu_inf,cj_inf from stu_inf LEFT JOIN cj_inf ON stu_inf.id=cj_inf.cj_stuid WHERE stu_inf.id=13;Query OK, 4 rows affected (0.00 sec)
After executing the statement:
Mysql > select * from stu_inf +-- +-+ | id | stu_xh | stu_xm | xb_id | xy_id | stu_bj | + -+ | 1 | 07150101 | Xiao Ming | 1 | 1 | 1504 | | 2 | 07150240 | Xie Yuzheng | 1 | 2 | 1502 | 3 | 12341231 | Monkey | 1 | 2 | 1515 | 4 | 01591261 | Da | 1 | 3 | 1515 | 5 | 07160202 | Xiao Hong | 2 | 4 | 1602 | 6 | 07150225 | Yellow River | 1 | 3 | 1315 | 7 | | 01050001 | Huarong | 1 | 7 | 1612 | | 8 | 02050002 | Huang Yueying | 2 | 8 | 1608 | 9 | 01510003 | Huanhuan | 2 | 9 | 1601 | | 10 | 05261005 | Dakang | 1 | 10 | 1304 | +- -- + 10 rows in set (0.00 sec) mysql > select * from cj_inf +-+ | cj_id | cj_stuid | cj_kmid | cj_score | +-+ | 1 | 3 | 1 | 87 | | 2 | 1 | 2 | 65 | | 3 | 4 | 1 | 77 | | 5 | 3 | 9 | 76 | 7 | 1 | 1 | 90 | +-+ 5 rows in set (0.02 sec)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.