sqlÖÐ:=ÊÇʲôÒâ˼
ÔÚ sql ÖУ¬”:=” ¸³ÖµÔËËã·ûÓÃÓÚ½«±í´ïʽµÄЧ¹û´æ´¢ÔÚÖ¸¶¨µÄ±äÁ¿ÖС£Ëü½«µÈºÅÓÒ²à±í´ïʽµÄÖµÁ¬Ã¦¸³¸øµÈºÅ×ó²àµÄ±äÁ¿¡£±ðµÄ£¬:= ÔÚÈκΠsql Óï¾ä£¨Èç´æ´¢Àú³Ì£©ÖпÉÓã¬ÊÇ set Óï¾äµÄÒ»¸öÌåÃû£¬µ«²»¿ÉΪÁлò±í¸³Öµ¡£
SQL ÖÐµÄ := ²Ù×÷·û
SQL ÖÐµÄ := ¸³ÖµÔËËã·ûÓÃÓÚÔÚ±äÁ¿Öд洢ֵ¡£¸³ÖµÔËËã·ûµÄ×÷ÓÃÊǽ«µÈºÅÓÒ²à±í´ïʽµÄЧ¹û´æ´¢ÔڵȺÅ×ó²àÖ¸¶¨µÄ±äÁ¿ÖС£
Ó÷¨
:= Óï·¨µÄ»ù±¾ÐÎʽΪ£º
±äÁ¿ := ±í´ïʽ
µÇ¼ºó¸´ÖÆ
ÆäÖУº
±äÁ¿ÊÇ´æ´¢±í´ïʽµÄЧ¹ûµÄ±äÁ¿¡£
±í´ïʽÊDZ¬·¢Òª´æ´¢µÄÖµµÄ SQL Óï¾ä¡£
ʾÀý
ÒÔÏÂÅÌÎʽ¨ÉèÒ»¸öÃûΪ total_sales µÄ±äÁ¿£¬ÆäÖд洢ÁË sales ±íÖÐËùÓÐÏúÊÛ¶îµÄ×ܺͣº
DECLARE total_sales INT; SET total_sales := (SELECT SUM(sale_amount) FROM sales);
µÇ¼ºó¸´ÖÆ
Ìصã
:= ÊÇÒ»¸öÁ¬Ã¦¸³ÖµÔËËã·û£¬ÕâÒâζ×űäÁ¿µÄÖµÔÚ¸³ÖµÓï¾äÖ´ÐÐʱÁ¬Ã¦¸ü¸Ä¡£
¿ÉÒÔÔÚÈκΠSQL Óï¾äÖÐʹÓà :=£¬°üÀ¨´æ´¢Àú³Ì¡¢º¯ÊýºÍ´¥·¢Æ÷¡£
:= ÊÇ SET Óï¾äµÄÒ»¸öÌåÃû£¬¿ÉÓÃÓÚ¸³Öµ¡£
×¢ÖØÊÂÏî
±äÁ¿±ØÐèÔÚʹÓÃÇ°ÉùÃ÷¡£
±í´ïʽ±ØÐ豬·¢Óë±äÁ¿Êý¾ÝÀàÐͼæÈݵÄÖµ¡£
:= ²»¿ÉÓÃÓÚΪÁлò±í¸³Öµ¡£
ÒÔÉϾÍÊÇsqlÖÐ:=ÊÇʲôÒâ˼µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡