sqlÖÐɾ³ý±íµÄÏÂÁî
ʹÓà delete Óï¾ä¿ÉÒÔ´Ó±íÖÐɾ³ýÊý¾Ý¡£delete Óï¾äµÄÓ﷨Ϊ£ºdelete from table_name where condition£»ÆäÖУ¬table_name ÊDZíÃû£¬condition ÊÇ¿ÉÑ¡µÄɸѡÌõ¼þ¡£ÈôÊÇδָ¶¨Ìõ¼þ£¬Ôòɾ³ý±íÖеÄËùÓмͼ¡£
SQL ÖÐɾ³ý±íµÄÏÂÁî
ÔÚ SQL ÖУ¬¿ÉÒÔʹÓà DELETE Óï¾äÀ´É¾³ý±íÖеÄÊý¾Ý¡£DELETE Óï¾äµÄÓï·¨ÈçÏ£º
DELETE FROM table_name WHERE condition;
µÇ¼ºó¸´ÖÆ
ÆäÖУº
table_nameÊÇҪɾ³ýÊý¾ÝµÄ±íÃû
conditionÊÇ¿ÉÑ¡µÄ£¬ÓÃÓÚÖ¸¶¨ÒªÉ¾³ýµÄÐÐ
ʾÀý
Ҫɾ³ý customers ±íÖеÄËùÓмͼ£¬¿ÉÒÔʹÓÃÒÔÏÂÓï¾ä£º
DELETE FROM customers;
µÇ¼ºó¸´ÖÆ
Ҫɾ³ý customers ±íÖÐÖª×ãÌض¨Ìõ¼þµÄ¼Í¼£¬¿ÉÒÔʹÓÃÒÔÏÂÓï¾ä£º
DELETE FROM customers WHERE age > 30;
µÇ¼ºó¸´ÖÆ
×¢ÖØÊÂÏî
DELETE Óï¾ä»áÓÀÊÀɾ³ýÊý¾Ý£¬Òò´ËÔÚÖ´ÐÐ֮ǰÎñ±ØСÐÄ¡£
ÈôÊÇûÓÐÖ¸¶¨Ìõ¼þ£¬DELETE Óï¾ä½«É¾³ý±íÖеÄËùÓмͼ¡£
¿ÉÒÔÔÚ WHERE ×Ó¾äÖÐʹÓÃÂß¼ÔËËã·û£¨ÀýÈç AND¡¢OR¡¢NOT£©À´½¨Éè¸üÖØ´óµÄÌõ¼þ¡£
Ò²¿ÉÒÔʹÓà TRUNCATE TABLE Óï¾äÀ´É¾³ý±íÖеÄËùÓÐÊý¾Ý£¬µ«Óë DELETE Óï¾ä²î±ðµÄÊÇ£¬TRUNCATE TABLE ²»»á¼Í¼ÔÚÊÂÎñÈÕÖ¾ÖУ¬Òò´ËËü±È DELETE ¸ü¿ì£¬µ«ÎÞ·¨»Ø¹ö¡£
ÒÔÉϾÍÊÇsqlÖÐɾ³ý±íµÄÏÂÁîµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡