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
< СÓÚ 2<1 False
<=  
Ïà¹ØÎĵµ£º
delimiter // ¸Ä±ä½ç¶¨·û Ϊ//
ÁгöËùÓÐÊý¾Ý¿â show databases;
ÁгöËùÓÐÊý¾Ý±í show tables;
¸Ä±äÁ¬½ÓÊý¾Ý¿â use databaes
²åÈë¼Ç¼ insert into users(UserName,Password) values('ivwshjj','123456');
ɾ³ý¼Ç¼ delete from users  ......
Ò»¡¢Êýѧº¯Êý
ABS(x) ·µ»ØxµÄ¾ø¶ÔÖµ
BIN(x)¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡·µ»ØxµÄ¶þ½øÖÆ£¨OCT·µ»Ø°Ë½øÖÆ£¬HEX·µ»ØÊ®Áù½øÖÆ£©
CEILING(x)   ......
ÔÚ×ÀÃæÉÏн¨Ò»¸ö¿ÕµÄÎı¾Îļþmysql.txt,ÖØÃüÃûΪmysql.udl,Ë«»÷Õâ¸ömysql.udlÎļþ£¬´ò¿ª“Êý¾Ý¿âÁ¬½ÓÊôÐÔ”¶Ô»°¿ò£¬ÔÚ“Ìṩ³ÌÐò”ҳѡÔñ”Micrsoft Ole DB Provider for ODBC Drivers“£¬ µã»÷ÏÂÒ»²½£¬ÔÚ“Á¬½Ó”Ò³µÄ,"Ö¸¶¨Êý¾ÝÔ´"Ñ¡Ôñ"ʹÓÃÁ¬½Ó×Ö·û´®",µã» ......
ÔÎÄת×Ôhttp://www.mysqlsystems.com/2009/04/mysql_sanbox.html
һȺº£ëàÔÚÊôÓÚ×Ô¼ºµÄº£Ì²ÉÏ×ÔÓɵÄÍæË££¬¾¡¹ÜÖ»ÊÇÒ»¸ö·½ºÐµÄ´óС£¬µ«ÊÇÉ豸һÑù
µÄÆëÈ«£¬Í¬Ñù¿ÉÒÔÍæµÄºÜ¿ªÐÄ£¬Õâ¾ÍÊÇÎÒ½ñÌìҪ˵µÄ——MySQL Sandbox2.0£¬3.0Ò²½«ÒªÍƳö¡£
MySQL
SandboxÊÇÒ»¸ö·Ç³£¼òµ¥¿ì½Ý²¿ÊðMySQL¼¼ÊõµÄÒ»¸ö¹¤¾ßÌ×¼þ£¬Ëü¿É ......