?漰????????????????2???
???????????? ???????[ 2012/10/12 10:01:32 ] ????????
?????????????????????????????????????????????????????????????????????????á?????????????????????????е??????????????????????????á????????????????漰?????????DELETE??UPDATE????????????????????????Щ???????????????????????????????????????2.8???????????????????????
??????????漰??????????DELETE??UPDATE??????????????????ж???????????????????????????????????????е???????????????????????????????t???id?????100????????????????????д????????????
????DELETE FROM t WHERE id > 100;
??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????t?????id?????????????????t2????????????????????????
???????д????漰?????????DELETE????????????漰?????????FROM?????????г????????????????й??????У??????????????????????????д??WHERE???????????????佫???????t1?????id?????????????????t2????????????????????
????DELETE t1 FROM t1 INNER JOIN t2 ON t1.id = t2.id;
????????????????е??????????????????????п?????????????????????????????????????????
????DELETE??????????????????????????????????????????С?????????????????????id????????????ж???????????DELETE?????????д?????????????????
????DELETE t1?? t2 FROM t1 INNER JOIN t2 ON t1.id = t2.id;
????????????????????????????У????????????漰?????????DELETE???????????????????SELECT???????κ????????????????????????????д????????????????????????е?SELECT?????·??????????????????????LEFT JOIN???????RIGHT JOIN?????????????????????t1??????????t2????????????????????????????д??????????????SELECT???
????SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.id = t2.id WHERE t2.id IS NULL;
????????????????t1??????????Щ?????е?DELETE???????????LEFT JOIN??????
????DELETE t1 FROM t1 LEFT JOIN t2 ON t1.id = t2.id WHERE t2.id IS NULL;
????MySQL???????????漰?????????DELETE????????????????FROM??????г???????????й??????е?????????????USING???????????й?????????????Щ?????????????????????????漰?????????DELETE????????????????д???????????????
????DELETE FROM t1 USING t1 INNER JOIN t2 ON t1.id = t2.id;
????DELETE FROM t1?? t2 USING t1 INNER JOIN t2 ON t1.id = t2.id;
????DELETE FROM t1 USING t1 LEFT JOIN t2 ON t1.id = t2.id WHERE t2.id IS NULL;
??????д?漰?????????UPDATE??????????????д?漰?????????DELETE?????????????????г????漰???????????????????????????????????е???????б?????????????????????????????2008??9??23??????????????????????????????д??????????????????????????????д????????????????λ???????????????????????????漰?????????UPDATE??????????????????
????UPDATE score?? grade_event SET scorescore.score = score.score + 1
????WHERE score.event_id = grade_event.event_id
????AND grade_event.date ='2008-09-23' AND grade_event.category = 'Q';
???????嵽?????????????????????????????????????2????????????????
????UPDATE score SET scorescore = score + 1
????WHERE event_id = (SELECT event_id FROM grade_event
????WHERE date = '2008-09-23' AND category = 'Q');
?????????????????2?????????????????????????????????????????????????????????????????????????????????????????Щ?????У???????????????????????????????????????????????????佫???????????t1.a?????t2.a??????????????????????????????id?????????
????UPDATE t1?? t2 SET t2.a = t1.a WHERE t2.id = t1.id;
??????????InnoDB???????ж?????????????2?????????????????????????????????????????佨?????????????????????ON DELETE CASCADE??ON UPDATE CASCADE?????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11