mysql 5.0´æ´¢¹ý³Ìѧϰ×ܽá
mysql 5.0´æ´¢¹ý³Ìѧϰ×ܽá
Ò».´´½¨´æ´¢¹ý³Ì
1.»ù±¾Óï·¨£º
create procedure
sp_name()
begin
………
end
2.²ÎÊý´«µÝ
¶þ.µ÷Óô洢¹ý³Ì
1.»ù±¾Óï·¨£ºcall
sp_name()
×¢Ò⣺´æ´¢¹ý³ÌÃû³ÆºóÃæ±ØÐë¼ÓÀ¨ºÅ£¬ÄÄŸô洢¹ý³ÌûÓвÎÊý´«µÝ
Èý.ɾ³ý´æ´¢¹ý³Ì
1.»ù±¾Óï·¨£º
drop procedure
sp_name//
2.×¢ÒâÊÂÏî
(1)²»ÄÜÔÚÒ»¸ö´æ´¢¹ý³ÌÖÐɾ³ýÁíÒ»¸ö´æ´¢¹ý³Ì£¬Ö»Äܵ÷ÓÃÁíÒ»¸ö´æ´¢¹ý³Ì
ËÄ.Çø¿é£¬Ìõ¼þ£¬Ñ»·
1.Çø¿é¶¨Ò壬³£ÓÃ
begin
……
end;
Ò²¿ÉÒÔ¸øÇø¿éÆð±ðÃû£¬È磺
lable:begin
………..
end
lable;
¿ÉÒÔÓÃleave lable;Ìø³öÇø¿é£¬Ö´ÐÐÇø¿éÒÔºóµÄ´úÂë
2.Ìõ¼þÓï¾ä
if
Ìõ¼þ
then
statement
else
statement
end
if
;
3.Ñ»·Óï¾ä
(1).whileÑ»·
[
label:
]
WHILE
expression DO
statements
END
WHILE
[
label
]
;
(2).loopÑ»·
[
label:
]
LOOP
statements
END
LOOP
[
label
]
;
(3).repeat untilÑ»·
[
label:
]
REPEAT
statements
UNTIL expression
END
REPEAT
[
label
]
;
Îå.ÆäËû³£ÓÃÃüÁî
1.show procedure
status
ÏÔʾÊý¾Ý¿âÖÐËùÓд洢µÄ´æ´¢¹ý³Ì»ù±¾ÐÅÏ¢£¬°üÀ¨ËùÊôÊý¾Ý¿â£¬´æ´¢¹ý³ÌÃû³Æ£¬´´½¨Ê±¼äµÈ
2.show create procedure
sp_name
ÏÔʾijһ¸ö´æ´¢¹ý³ÌµÄÏêϸÐÅÏ¢
mysql´æ´¢¹ý³ÌÖÐÒªÓõ½µÄÔËËã·û
mysql´æ´¢¹ý³Ìѧϰ×ܽᣲÙ×÷·û
ËãÊõÔËËã·û
+ ¼Ó SET var1=2+2; 4
- ¼õ SET
var2=3-2; 1
* ³Ë SET var3=3*2; 6
/ ³ý SET
var4=10/3; 3.3333
DIV Õû³ý SET var5=10 DIV 3; 3
% È¡Ä£ SET
var6=10%3 ; 1
±È½ÏÔËËã·û
>
´óÓÚ 1>2 False
< &n
Ïà¹ØÎĵµ£º
±³¾°£ºÄ³¸öϵͳµÄmysqlÊý¾Ý¿âdnname²ÉÓÃĬÈϵÄlatin1×Ö·û¼¯£¬ÏµÍ³Éý¼¶ÐèÒª½«ËùÓÐÊý¾Ýת»»³Éutf-8¸ñʽ£¬Ä¿±êÊý¾Ý¿âΪnewdbname(½¨¿âʱʹÓÃutf8)
·½·¨Ò»£º
²½ÖèÒ» ÃüÁîÐÐÖ´ÐУºmysqldump --opt -hlocalhost -uroot -p*** --default-character-set=lantin1 dbname > /usr/local/dbname.sql
²½Öè¶þ ½« dbname.s ......
Õ⼸ÌìËù×÷µÄ¹¤×÷Éæ¼°µ½Êý¾Ý¿âÐÐתÁеÄÎÊÌâ
¼Ç¼һϳöÏֵĴíÎó£¬ÒÔÃâÒÔºóÔÙ·¸
¾ÙÍøÉÏ×îͨË×µÄÀý×Ó°É
Name Subject Result
ÕÅÈý ÓïÎÄ 80
ÕÅÈý Êýѧ 90
ÕÅÈý ÎïÀí &n ......
9.3. Óû§±äÁ¿
¿ÉÒÔÏÈÔÚÓû§±äÁ¿Öб£´æֵȻºóÔÚÒÔºóÒýÓÃËü£»ÕâÑù¿ÉÒÔ½«Öµ´ÓÒ»¸öÓï¾ä´«µÝµ½ÁíÒ»¸öÓï¾ä¡£Óû§±äÁ¿ÓëÁ¬½ÓÓйØ
¡£Ò²¾ÍÊÇ˵£¬Ò»¸ö¿Í»§¶Ë¶¨ÒåµÄ±äÁ¿²»Äܱ»ÆäËü¿Í»§¶Ë¿´µ½»òʹÓᣵ±¿Í»§¶ËÍ˳öʱ£¬¸Ã¿Í»§¶ËÁ¬½ÓµÄËùÓбäÁ¿½«×Ô¶¯ÊÍ·Å¡£
Óû§±äÁ¿µÄÐÎʽΪ@var_name
£¬ÆäÖбäÁ¿Ãûvar_name
¿ÉÒÔÓɵ±Ç°×Ö· ......
¡¡±àÒëºÍÁ¬½Ó³ÌÐò
¡¡¡¡MySQLÖÐÓÐÒ»¸öÌØÊâµÄ½Å±¾,½Ð×ömysql_config. Ëü»áΪÄã±àÒëMySQL¿Í»§¶Ë,²¢Á¬½Óµ½MySQL·þÎñÆ÷ÌṩÓÐÓõÄÐÅÏ¢.ÄãÐèҪʹÓÃÏÂÃæÁ½¸öÑ¡Ïî.
¡¡¡¡1. --libs Ñ¡Ïî - Á¬½ÓMySQL¿Í»§¶Ëº¯Êý¿âËùÐèÒªµÄ¿âºÍÑ¡Ïî.
¡¡¡¡$ mysql_config --libs
¡¡¡¡2. --cflags Ñ¡Ïî - ʹÓñØÒªµÄincludeÎļþµÄÑ¡ÏîµÈµÈ.
......
ÏîÄ¿Òª½áÊøÁË...ÖÁÉÙ¿ª·¢Òª½áÊøÁË...
»ØÍ·¿´¿´×Ô¼º¾ÍÕâôһ¸öÈËÂñÍ·¿ª·¢ÁË4¸öÔ£¬ÒÔ¼°ÊÖÉÏÄõ½µÄÓë×Ô¼º¸¶³öÍêÈ«²»³ÉÕý±ÈµÄ΢±¡¹¤×Ê£¬¾õµÃ×Ô¼ºÕætmdµÄ±¯¾ç£¡
»òÐíÕâ¾ÍÊÇÓ¦½ì±ÏÒµÉúµÄÃü°É...¶÷£¬ÏÖÔÚÎÒÒѾ²»ÊÇÓ¦½ì±ÏÒµÉúÁË...
ÏÖÔÚÏîÄ¿×öÍêÁË£¬ÎÒÒ²¾¡µ½ÁËÉÆʼÉÆÖÕµÄÒåÎñÁË...
¿àË®¾Íµ¹µ½ÕâÀ»¹ÊǻعéÕýÌâ¡£
ÓÉÓ ......