Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

mysql 5.0´æ´¢¹ý³Ìѧϰ×ܽá


from:http://www.ccvita.com/100.html
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
<            СÓÚ 2<1 False
<=&nbs


Ïà¹ØÎĵµ£º

MySQLÊý¾Ý¿â»·¾³Ê¹ÓÃÈ«¹ý³Ì

1.1.1    MySQLÏÂÔØ¡¢°²×°ÓëÆô¶¯
ÔÚʹÓÃMySQL֮ǰ£¬ÐèÒª½¨Á¢Êý¾Ý¿âµÄ»·¾³À´´´½¨Êý¾Ý±í£¬Ê×ÏÈÎÒÃÇÐèÒª°²×°¸ÃÊý¾Ý¿â»·¾³£¬¼´MySQL¡£
1¡¢ÏÂÔØMySQL
MySQLµÄ¹Ù·½ÍøÕ¾ÊÇhttp://www.mysql.org/£¬Èçͼ2-9Ëùʾ£º
ͼ2-9  MySQL¹Ù·½ÍøÕ¾
µ±Ç°Îȶ¨°æ±¾Îª5.1£¬ÎÒÃÇÑ¡ÓÃMySQL 5.1.22×÷ΪÊý¾Ý¿â·þÎñÆ÷£¬µ½Æä¹Ù·½ ......

½â¾öÒ³ÃæÊý¾ÝÌá½»µ½mysqlÊý¾Ý¿âºó³öÏÖÖÐÎÄÂÒÂëµÄ·½·¨

1. ÔÚʹÓÃNavicat 8 for MySQL¿Í»§¶Ë´´½¨Êý¾Ý¿âʱ£¬±àÂëµÄÉèÖÃÈçÏÂͼ£º
     
2. ½«°²×°Ä¿Â¼F:\MySQL\MySQL Server 5.1Ï£¬my.iniÎļþÉèÖñäÁ¿Öµdefault-character-set=gbk £¨°üº¬Á½´¦£¬¿É²éÕÒdefault-character-set£©£¬È»ºóÖØÆôMYSQL·þÎñ¡£ ......

Ubuntu 9.04 ÏÂMySQLÖÐÎÄÂÒÂëµÄ½â¾ö

        Ubuntu 9.04 ÏÂÓÃÔ´°²×°ÁËMySQL¡£Ä¬ÈÏÇé¿öÏ£¬ÓÃmysql shellµÇ¼´´½¨Êý¾Ý¿â´´½¨±í²åÈëÖÐÎÄÊý¾Ýºó£¬ÓÃselect²é³öÀ´ÊÇÖÐÎÄ£¬µ«ÓÃJDBCÁ¬½Ó¾Í³öÏÖÂÒÂë¡£ÍøÉÏËÑË÷µ½½â¾ö·½·¨£¬ÈçÏ£¨Ïȱ¸·ÝÊý¾Ý£©£º
ÐÞ¸Ä/etc/mysql/my.cnf
sudo gedit /etc/mysql/my.cnf
ÔÚmy.cnfÎļþÖеÄ[client] ......

mysqlÃâ°²×°°æÅäÖÃÓëʹÓ÷½·¨

ÒÔmysql-noinstall-5.1.6(win32)ΪÀý
1>°ÑѹËõÎļþmysql-noinstall-5.1.6-alpha-win32.zip½âѹµ½Ò»¸öĿ¼Ï£¬ÔÚ»·¾³±äÁ¿ÖÐÉèÖÃMYSQL_HOME£¬°Ñ%MYSQL_HOME%\bin ¼Ó
Èëµ½ path¡£
2>´´½¨my.iniÅäÖÃÎļþ,ÄÚÈÝÈçÏ£º
[mysqld]
#ÉèÖÃbasedirÖ¸ÏòmysqlµÄ°²×°Â·¾¶
basedir=...\mysql
datadir=...\mysql\data
my.iniÎ ......

ÔÚMySQLÖе¼Èëµ¼³öÎļþ

Ç°Ì᣺MySQLÖдæÔÚÒ»¸öÓû§×Ô¼º½¨Á¢µÄÊý¾Ý¿â£¬¼ÙÉèΪmydb£¬mydbÖÐÓÐÒ»ÕÅÓû§×Ô¼º½¨Á¢µÄ±í¸ñ£¬¼ÙÉèÃû³ÆΪmytable
ÎÒµÄÇ°Ì᣺MySQLÖдæÔÚÁ½¸öÊý¾Ý¿â£¬yldbºÍyldb2£¬ÆäÖÐyldbÊý¾Ý¿âÖÐÓÐÒ»ÕÅ±í£¬ÃûΪpet
Ò».MYSQLµÄÃüÁîÐÐģʽµÄÉèÖãº
×ÀÃæ->ÎҵĵçÄÔ->ÊôÐÔ->»·¾³±äÁ¿->н¨->
PATH=“£»path\mysql\bin ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ