SQL DELETE fromµÄÓ÷¨
ÔÚijЩÇé¿öÏ£¬ÎÒÃÇ»áÐèÒªÖ±½ÓÓÉÊý¾Ý¿âÖÐÈ¥³ýһЩ×ÊÁÏ¡£Õâ¿ÉÒÔ½åÓÉ DELETE from Ö¸ÁîÀ´´ï³É¡£ËüµÄÓï·¨ÊÇ£º
DELETE from "±í¸ñÃû"
WHERE {Ìõ¼þ}
ÒÔÏÂÎÒÃÇÓøöʵÀý˵Ã÷¡£¼ÙÉèÎÒÃÇÓÐÒÔÏÂÕâ¸ö±í¸ñ£º
Store_Information ±í¸ñ
store_name
Sales
Date
Los Angeles
$1500
Jan-05-1999
San Diego
$250
Jan-07-1999
Los Angeles
$300
Jan-08-1999
Boston
$700
Jan-08-1999
¶øÎÒÃÇÐèÒª½«ÓÐ¹Ø Los Angeles µÄ×ÊÁÏÈ«²¿È¥³ý¡£ÔÚÕâÀïÎÒÃÇ¿ÉÒÔÓÃÒÔÏ嵀 SQL À´´ïµ½Õâ¸öÄ¿µÄ:
DELETE from Store_Information
WHERE store_name = "Los Angeles"
ÏÖÔÚ±í¸ñµÄÄÚÈݱä³É£º
Store_Information ±í¸ñ
store_name
Sales
Date
San Diego
$250
Jan-07-1999
Boston
$700
Jan-08-1999
Ïà¹ØÎĵµ£º
½ÓÏÂÀ´£¬ÎÒÃÇÌÖÂÛ alias (±ðÃû) ÔÚ SQL ÉϵÄÓô¦¡£×î³£Óõ½µÄ±ðÃûÓÐÁ½ÖÖ£º À¸Î»±ðÃû¼°±í¸ñ±ðÃû¡£
¼òµ¥µØÀ´Ëµ£¬À¸Î»±ðÃûµÄÄ¿µÄÊÇΪÁËÈà SQL ²úÉúµÄ½á¹ûÒ׶Á¡£ÔÚ֮ǰµÄÀý×ÓÖУ¬ ÿµ±ÎÒÃÇÓÐÓªÒµ¶î×ܺÏʱ£¬À¸Î»Ãû¶¼ÊÇ SUM(sales)¡£ ËäÈ»ÔÚÕâ¸öÇé¿öÏÂûÓÐʲôÎÊÌ⣬¿ÉÊÇÈç¹ûÕâ¸öÀ¸Î»²»ÊÇÒ»¸ö¼òµ¥µÄ×ܺϣ¬¶øÊÇÒ»¸ö¸´ÔӵļÆË㣬 ......
ÊÓ¹Û±í (Views) ¿ÉÒÔ±»µ±×÷ÊÇÐéÄâ±í¸ñ¡£Ëü¸ú±í¸ñµÄ²»Í¬ÊÇ£¬±í¸ñÖÐÓÐʵ¼Ê´¢´æ×ÊÁÏ£¬¶øÊÓ¹Û±íÊǽ¨Á¢ÔÚ±í¸ñÖ®ÉϵÄÒ»¸ö¼Ü¹¹£¬Ëü±¾Éí²¢²»Êµ¼Ê´¢´æ×ÊÁÏ¡£
½¨Á¢Ò»¸öÊÓ¹Û±íµÄÓï·¨ÈçÏ£º
CREATE VIEW "VIEW_NAME" AS "SQL Óï¾ä"
"SQL Óï¾ä" ¿ÉÒÔÊÇÈκÎÒ»¸öÎÒÃÇÔÚÕâ¸ö½Ì²ÄÖÐÓÐÌáµ½µÄ SQL¡£
À´¿´Ò»¸öÀý×Ó¡£¼ÙÉèÎÒÃÇÓÐÒÔϵıí¸ñ£ ......
ÔÚ±í¸ñ±»½¨Á¢ÔÚ×ÊÁÏ¿âÖкó£¬ÎÒÃdz£³£»á·¢ÏÖ£¬Õâ¸ö±í¸ñµÄ½á¹¹ÐèÒªÓÐËù¸Ä±ä¡£³£¼ûµÄ¸Ä±äÈçÏ£º
¼ÓÒ»¸öÀ¸Î»
ɾȥһ¸öÀ¸Î»
¸Ä±äÀ¸Î»Ãû³Æ
¸Ä±äÀ¸Î»µÄ×ÊÁÏÖÖÀà
ÒÔÉÏÁгöµÄ¸Ä±ä²¢²»ÊÇËùÓпÉÄܵĸı䡣ALTER TABLE Ò²¿ÉÒÔ±»ÓÃÀ´×÷ÆäËûµÄ¸Ä±ä£¬ÀýÈç¸Ä±äÖ÷¼ü¶¨Òå¡£
ALTER TABLE µÄÓï·¨ÈçÏ£º
ALTER TABLE "table_name"
......
ÓÐʱºòÎÒÃÇ»á¾ö¶¨ÎÒÃÇÐèÒª´ÓÊý¾Ý¿âÖÐÇå³ýÒ»¸ö±í¸ñ¡£ÊÂʵÉÏ£¬Èç¹ûÎÒÃDz»ÄÜÕâÑù×öµÄ»°£¬Äǽ«»áÊÇÒ»¸öºÜ´óµÄÎÊÌ⣬ÒòΪÊý¾Ý¿â¹ÜÀíʦ (Database Administrator -- DBA) ÊƱØÎÞ·¨¶ÔÊý¾Ý¿â×öÓÐЧÂʵĹÜÀí¡£»¹ºÃ£¬SQL ÓÐÌṩһ¸ö DROP TABLEµÄÓï·¨À´ÈÃÎÒÃÇÇå³ý±í¸ñ¡£ DROP TABLE µÄÓï·¨ÊÇ£º
DROP TABLE "±í¸ñÃû"
ÎÒÃÇÈç¹ûÒªÇå³ ......
ÓÐʱºòÎÒÃÇ»áÐèÒªÇå³ýÒ»¸ö±í¸ñÖеÄËùÓÐ×ÊÁÏ¡£Òª´ïµ½Õ߸öÄ¿µÄ£¬Ò»ÖÖ·½Ê½ÊÇÎÒÃÇÔÚ SQL DROP ÄÇÒ»Ò³ ¿´µ½µÄ DROP TABLE Ö¸Áî¡£²»¹ýÕâÑùÕû¸ö±í¸ñ¾ÍÏûʧ£¬¶øÎÞ·¨ÔÙ±»ÓÃÁË¡£ÁíÒ»ÖÖ·½Ê½¾ÍÊÇÔËÓà TRUNCATE TABLE µÄÖ¸Áî¡£ÔÚÕâ¸öÖ¸Áî֮ϣ¬±í¸ñÖеÄ×ÊÁÏ»áÍêÈ«Ïûʧ£¬¿ÉÊDZí¸ñ±¾Éí»á¼ÌÐø´æÔÚ¡£ TRUNCATE TABLE µÄÓ﷨ΪÏ£º
TRUNCATE ......