sqlÖÐÇå¿Õ±íÊý¾ÝµÄÏÂÁîÓÐÄÄЩ
sql Çå¿Õ±íÊý¾ÝµÄÏÂÁîÓÐÁ½ÖÖ£ºtruncate table ºÍ delete¡£truncate table Ö±½Ó½Ø¶Ï±í£¬É¾³ýËùÓÐÊý¾Ýµ«±£´æ½á¹¹£¬ËÙÂʿ죬²»¿É»Ø¹ö£»delete ÖðÐÐɾ³ýÊý¾Ý£¬¿É¹ýÂËɾ³ýÌõ¼þ£¬Äܻعöµ«ËÙÂʽÏÂý¡£
SQL Çå¿Õ±íÊý¾ÝµÄÏÂÁî
ÔÚ SQL ÖУ¬ÓÐÁ½ÖÖÖ÷ÒªÏÂÁî¿ÉÓÃÓÚÇå¿Õ±íÊý¾Ý£º
TRUNCATE TABLE
DELETE
TRUNCATE TABLE
TRUNCATE TABLE ÏÂÁîÊÇÒ»ÖÖ¿ìËÙ¶øÓÐÓõÄÇå¿Õ±íÊý¾ÝµÄ·½·¨¡£ËüÖ±½Ó½Ø¶Ï±í£¬É¾³ýËùÓÐÐкÍÊý¾Ý£¬µ«±£´æ±í½á¹¹ºÍÈκÎÔ¼Êø¡£
TRUNCATE TABLE table_name;
µÇ¼ºó¸´ÖÆ
˞񾣼
·Ç³£¿ì£¬ÓÉÓÚËü²»»áÖ´ÐÐÖðÐÐɾ³ý²Ù×÷¡£
±£´æ±í½á¹¹¡£
Èõµã£º
ÎÞ·¨»Ø¹ö¡£
ÈôÊÇÓÐÍâ¼üÔ¼Êø£¬¿ÉÄܻᱬ·¢¹ýʧ¡£
DELETE
DELETE ÏÂÁîÖðÐÐɾ³ý±íÖеÄÊý¾Ý¡£Ëü½ÓÊÜÒ»¸ö¿ÉÑ¡µÄ WHERE ×Ӿ䣬ÔÊÐíƾ֤Ìض¨Ìõ¼þ¹ýÂËҪɾ³ýµÄÐС£
DELETE FROM table_name [WHERE condition];
µÇ¼ºó¸´ÖÆ
˞񾣼
¿ÉÒÔʹÓà WHERE ×Ó¾ä¹ýÂËҪɾ³ýµÄÐС£
¿ÉÒԻعö£¬Ìõ¼þÊÇÆôÓÃÁËÊÂÎñ¡£
Èõµã£º
±È TRUNCATE TABLE Âý£¬ÓÈÆäÊÇÔÚ±íºÜ´óʱ¡£
»á±¬·¢ÈÕÖ¾¼Í¼¿ªÏú¡£
Ñ¡ÔñºÏÊʵÄÏÂÁî
ÔÚÑ¡Ôñ TRUNCATE TABLE ºÍ DELETE ÏÂÁîʱ£¬Ó¦Ë¼Á¿ÒÔÏÂÒòËØ£º
ÐÔÄÜ£º TRUNCATE TABLE ͨ³£±È DELETE ËÙÂʸü¿ì¡£
»Ø¹ö£º ÈôÊÇÐèÒª»Ø¹öɾ³ý²Ù×÷£¬ÔòӦʹÓà DELETE¡£
Íâ¼üÔ¼Êø£º TRUNCATE TABLE ¿ÉÄÜ»áÓëÍâ¼üÔ¼Êø³åÍ»¡£
¹ýÂË£º ÈôÊÇÐèҪƾ֤Ìõ¼þɾ³ýÐУ¬ÔòӦʹÓà DELETE¡£
ÒÔÉϾÍÊÇsqlÖÐÇå¿Õ±íÊý¾ÝµÄÏÂÁîÓÐÄÄЩµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡