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

СÌâ´ó×öÖ®MySQL 5.0´æ´¢¹ý³Ì±à³ÌÈëÃÅ

MySQL °æ±¾£º5.0.45    phpMyAdmin°æ±¾£º2.11.3
 
Ê×ÏÈ¿´MySQL 5.0²Î¿¼ÊÖ²áÖйØÓÚ´´½¨´æ´¢¹ý³ÌµÄÓ﷨˵Ã÷£º
 
CREATE
    [DEFINER = { user | CURRENT_USER }]
    PROCEDURE sp_name ([proc_parameter[,...]])
    [characteristic ...] routine_body
   
proc_parameter:
    [ IN | OUT | INOUT ] param_name type
type:
    Any valid MySQL data type
characteristic:
    LANGUAGE SQL
  | [NOT] DETERMINISTIC
  | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }
  | SQL SECURITY { DEFINER | INVOKER }
  | COMMENT 'string'
routine_body:
    Valid SQL procedure statement
 
Èç¹ûÄã¶ÔMySQL»¹²»Ì«ÊìϤµÄ»°£¬µ¥µ¥¿´Õâ¸öÓï·¨½á¹¹µ±È»²»×ãÒÔ½øÐÐMySQL´æ´¢¹ý³Ì±à³Ì¡£ÎÒ֮ǰ»ù±¾¶¼ÊÇʹÓÃMS SQL SERVER£¬ËùÒÔÒÔϼǼÎÒÊìϤMySQL´æ´¢¹ý³ÌµÄ¹ý³Ì£¬Ò²ÊÇÖØµã½éÉÜMS SQL SERVERÓëMySQLÇø±ð½Ï´óµÄµØ·½¡£
 
µÚÒ»²½£¬µ±È»ÊÇд¸öHello WordµÄ´æ´¢¹ý³Ì£¬ÈçÏ£º
CREATE PROCEDURE phelloword()
BEGIN
  SELECT 'Hello Word!' AS F;
END;
 
½«ÉÏÃæ´´½¨phelloword´æ´¢¹ý³ÌµÄÓï¾ä¿½µ½phpMyAdminÖÐÖ´ÐУ¬±¨ÈçÏ´íÎó£º
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3
 
ÔÚÕâ¸öÎÊÌâÉÏÎÒ¾À²øÁ˺ܾã¬ÔÚMySQLµÄÃüÁîÐй¤¾ßÖÐÖ´ÐÐͬÑù²»³É¹¦£¬µ«ÊǸù¾ÝÌáʾÐÅÏ¢¿ÉÒÔÖªµÀÖ´ÐÐÔÚ SELECT 'Hello Word!' AS F;´¦½áÊø£¬ºóÃæµÄEND;ûÓÐÖ´ÐУ¬ÕâÏÔÈ»»áµ¼Ö´íÎó¡£
ÕâÀïÐèҪѡÔñÒÔ¸ö·Ö¸ô·û£¬Óï·¨ÈçÏ£ºDELIMITER //
·Ö¸ô·ûÊÇ֪ͨMySQL¿Í»§¶ËÒѾ­ÊäÈëÍê³ÉµÄ·ûºÅ¡£Ò»Ö±¶¼ÊÇÓÓ;”£¬µ«ÊÇÔÚ´æ´¢¹ý³ÌÖв»ÐУ¬ÒòΪ´æ´¢¹ý³ÌÖкܶàÓï¾ä¶¼ÐèÒªÓõ½·ÖºÅ¡£
Òò´ËÉÏÃæµÄ´æ´¢¹ý³Ì¸ÄΪ£º
CREATE PROCEDURE ptest()
BEGIN
  SELECT 'Hello Word!' AS F;
END //
 
ÁíÍâÔÚphpMyAdminÖÐÖ´ÐÐʱ£¬ÔÚDelimiterÎı¾¿òÖÐÌîд //£¬Õâ´Î´æ´¢¹ý³Ì¼´¿É´´½¨³É¹¦¡£
 
µÚ¶þ²½£¬Ð´Ò»¸ö°üÀ¨²ÎÊý£¬±äÁ¿£¬±äÁ¿¸³Öµ£¬Ìõ¼þÅжϣ¬UPDATEÓï¾ä£¬SELECT·µ»Ø½á¹û¼¯µÄÍêÕûµÄÒ»¸ö´æ´¢¹ý³Ì£¬ÈçÏ£º
CREATE


Ïà¹ØÎĵµ£º

OracleºÍMySQL¡¢PostgreSQLÌØÐÔ¶Ô±È

¡¡Ëæ×ÅÏÖ´úÊý¾Ý¿â¿ÉÓÃÌØÕ÷¼¯µÄѸËÙÔö¼Ó£¬ºÜÄÑÇø·ÖÊëºÃÊ뻵¡£ÀýÈçOracleÀï¾ÍÓÐÐí¶àÄã¿ÉÄÜ´ÓÀ´¶¼²»ÐèÒªµÄ¸ß¼¶Êý¾Ý²Ö¿âÌØÕ÷¡£´ËÍâÒ²¿ÉÄÜÓÐһЩÆäËü²»¿É»òȱµÄÌØÕ÷±ÈÈçACIDÊÂÎñÌØÐÔ¡£ÎÒÃÇÀ´¿´Ò»¿´Ö÷ÒªµÄÒ»Ð©ÌØÕ÷£¬±ÈÈç´æ´¢¹ý³Ì£¬ÊÓͼ£¬¿ìÕÕ£¬±íÊý¾ÝÀàÐͺÍÊÂÎñµÈµÈ¡£Í¬Ê±ÎÒÃÇ·ÖÎöÒ»ÏÂPostgresql£¬MySQLºÍOracleÕ⼸¸öÊý¾Ý¿â£¬È»º ......

½â¾ö.netÁ¬½ÓmysqlÂÒÂë

µ±mysqlÊý¾Ý¿âΪGBK±àºÅ£¬.net³ÌÐòʹÓÃĬÈϱàÂ루UTF-8£©£¬ÏòmysqlÖвåÈëÊý¾ÝÈÝÒײúÉúÂÒÂë¡£½â¾ö°ì·¨ÊÇÔÚÁ¬½Ó×Ö·û´®¼ÓÈëCharset=gbk£º
MySqlConnection myConnection = new MySqlConnection("Database=test2;Data Source=localhost;User Id=root;Password=ikmbikmb;Charset=gbk"); ......

MySQLÃüÁîÐÐÖÐÎÄÂÒÂëÎÊÌâ½â¾ö

ÎÊÌ⣺
1¡¢Êý¾Ý¿âĬÈϵÄ×Ö·û¼¯ÉèÖÃΪUTF-8£»
2¡¢Í¨¹ýibatis¶ÁдÊý¾ÝÖÐÎÄÕý³££»
3¡¢µ«ÊÇÓÃwindowsÃüÁîÐÐÖ´ÐÐselectÓï¾äÖÐÎÄÏÔʾÂÒÂë¡£
½â¾ö£º
Êý¾Ý¿âÓû§µÇ¼ʱ²ÎÊýÉ趨×Ö·û¼¯£º
mysql --default-character-set=gb2312 -u Óû§Ãû -p
£¨¹À¼ÆºÍwindowsµÄcmdÃüÁîÐÐÓйأ© ......

MYSQLÍâ¼ü(Foreign Key)µÄʹÓÃ


ÔÚMySQL 3.23.44°æ±¾ºó£¬InnoDBÒýÇæÀàÐ͵ıíÖ§³ÖÁËÍâ¼üÔ¼Êø¡£
Íâ¼üµÄʹÓÃÌõ¼þ£º
1.Á½¸ö±í±ØÐëÊÇ
InnoDB±í£¬MyISAM±íÔÝʱ²»Ö§³ÖÍâ¼ü£¨¾Ý˵ÒÔºóµÄ°æ±¾ÓпÉÄÜÖ§³Ö£¬µ«ÖÁÉÙĿǰ²»Ö§³Ö£©£»
2.Íâ¼üÁбØÐ뽨Á¢ÁËË÷Òý£¬MySQL
4.1.2ÒÔºóµÄ°æ±¾ÔÚ½¨Á¢Íâ¼üʱ»á×Ô¶¯´´½¨Ë÷Òý£¬µ«Èç¹ûÔÚ½ÏÔçµÄ°æ±¾ÔòÐèÒªÏÔʾ½¨Á¢£»
3.Íâ¼ü¹ØÏµµ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ