mysql±äÁ¿ÀàÐÍ
9.3. Óû§±äÁ¿
¿ÉÒÔÏÈÔÚÓû§±äÁ¿Öб£´æֵȻºóÔÚÒÔºóÒýÓÃËü£»ÕâÑù¿ÉÒÔ½«Öµ´ÓÒ»¸öÓï¾ä´«µÝµ½ÁíÒ»¸öÓï¾ä¡£Óû§±äÁ¿ÓëÁ¬½ÓÓйØ
¡£Ò²¾ÍÊÇ˵£¬Ò»¸ö¿Í»§¶Ë¶¨ÒåµÄ±äÁ¿²»Äܱ»ÆäËü¿Í»§¶Ë¿´µ½»òʹÓᣵ±¿Í»§¶ËÍ˳öʱ£¬¸Ã¿Í»§¶ËÁ¬½ÓµÄËùÓбäÁ¿½«×Ô¶¯ÊÍ·Å¡£
Óû§±äÁ¿µÄÐÎʽΪ@var_name
£¬ÆäÖбäÁ¿Ãûvar_name
¿ÉÒÔÓɵ±Ç°×Ö·û¼¯µÄÎÄ×ÖÊý×Ö×Ö·û¡¢‘.
’¡¢‘_
’ºÍ‘$
’×é³É¡£
ĬÈÏ×Ö·û¼¯ÊÇcp1252
(Latin1)
¡£¿ÉÒÔÓÃmysqld
µÄ--default-character-set
Ñ¡Ïî¸ü¸Ä×Ö·û¼¯¡£²Î¼û5.10.1½Ú£¬“Êý¾ÝºÍÅÅÐòÓÃ×Ö·û¼¯”
¡£Óû§±äÁ¿Ãû¶Ô´óСд²»Ãô¸Ð¡£
ÉèÖÃÓû§±äÁ¿µÄÒ»¸ö;¾¶ÊÇÖ´ÐÐSET
Óï¾ä£º
SET @
var_name
=
expr
[, @
var_name
=
expr
] ...
¶ÔÓÚSET
£¬¿ÉÒÔʹÓÃ=
»ò:=
×÷Ϊ·ÖÅä·û¡£·ÖÅä¸øÿ¸ö±äÁ¿µÄexpr
¿ÉÒÔΪÕûÊý¡¢ÊµÊý¡¢×Ö·û´®»òÕßNULL
Öµ¡£
Ò²¿ÉÒÔÓÃÓï¾ä´úÌæSET
À´ÎªÓû§±äÁ¿·ÖÅäÒ»¸öÖµ¡£ÔÚÕâÖÖÇé¿öÏ£¬·ÖÅä·û±ØÐëΪ:=
¶ø²»ÄÜÓÃ=
£¬ÒòΪÔÚ·ÇSET
Óï¾äÖÐ=
±»ÊÓΪһ¸ö±È½Ï
²Ù×÷·û£º
mysql>
SET @t1=0, @t2=0, @t3=0;
mysql>
SELECT @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
+----------------------+------+------+------+
| @t1:=(@t2:=1)+@t3:=4 | @t1 | @t2 | @t3 |
+----------------------+------+------+------+
| 5 | 5 | 1 | 4 |
+----------------------+------+------+------+
Óû§±äÁ¿¿ÉÒÔÓÃÓÚ±í´ïʽÖС£Ä¿Ç°²»°üÀ¨Ã÷ÏÔÐèÒªÎÄ×ÖÖµµÄÉÏÏÂÎÄÖУ¬ÀýÈçSELECT
Óï¾äµÄLIMIT
×Ӿ䣬»òÕßLOAD
DATA
Óï¾äµÄIGNORE
number LINES
×Ӿ䡣
Èç¹ûʹÓÃûÓгõʼ»¯µÄ±äÁ¿£¬ÆäÖµÊÇNULL
¡£
Èç¹ûÓû§±äÁ¿·ÖÅäÁËÒ»¸ö×Ö·û´®Öµ£¬Æä×Ö·û¼¯ºÍУ¶Ô¹æÔòÓë¸Ã×Ö·û´®µÄÏàͬ¡£Óû§±äÁ¿µÄ¿ÉѹËõÐÔ£¨coercibility
£©ÊÇÒþº¬µÄ¡£(
¼´Îª±íÁÐÖµµÄÏàͬµÄ¿ÉѹËõÐÔ£¨coercibility
£©¡£
×¢ÊÍ£º
ÔÚSELECT
Óï¾äÖУ¬±í´ïʽ·¢Ë͵½¿Í»§¶Ëºó²Å½øÐмÆËã¡£Õâ˵Ã÷ÔÚHAVING
¡¢GROUP
BY
»òÕßORDER
BY
×Ó¾äÖУ¬²»ÄÜʹÓðüº¬SELECT
ÁбíÖÐËùÉèµÄ±äÁ¿µÄ±í´ïʽ¡£ÀýÈ磬ÏÂÃæµÄÓï¾ä²»ÄÜ°´ÆÚÍû¹¤×÷£º
mysql>
SELECT (@aa:=id) AS a
£¬(@aa+3) AS b
´Ó
Ïà¹ØÎĵµ£º
MySQLÖÐʹÓô洢¹ý³Ì
ʹÓÃCallableStatementsÖ´Ðд洢¹ý³Ì
mysql°æ±¾:5.0
Connector/JµÄ°æ±¾:3.1.1ÒÔÉÏ(java.sql.CallableStatement½Ó¿ÚÒÑÍêȫʵÏÖ,³ýÁËgetParameterMetaData()·½·¨)
MySQLµÄ´æ´¢¹ý³ÌÓï·¨ÔÚMySQL²Î¿¼ÊÖ²áµÄ"´æ´¢¹ý³ÌºÍº¯Êý"Ò»ÕÂ.
http://www.mysql.com/doc/en/Stored_Procedures.html
ÏÂÃæÊÇÒ»¸ ......
À´Ô´£ºhttp://www.sudone.com/linux/mysql_debug.html
×÷ÕߣºAyou
ÎÒÒ»Ö±ÊÇʹÓÃmysqlÕâ¸öÊý¾Ý¿âÈí¼þ£¬Ëü¹¤×÷±È½ÏÎȶ¨£¬Ð§ÂÊÒ²ºÜ¸ß¡£ÔÚÓöµ½ÑÏÖØÐÔÄÜÎÊÌâʱ£¬Ò»°ã¶¼ÓÐÕâô¼¸ÖÖ¿ÉÄÜ£º
1¡¢Ë÷ÒýûÓн¨ºÃ£»
2¡¢sqlд·¨¹ýÓÚ¸´ÔÓ£»
3¡¢ÅäÖôíÎó£»
4¡¢»úÆ÷ʵÔÚ¸ººÉ²»ÁË£»
1¡¢Ë÷ÒýûÓн¨ºÃ
Èç¹û¿´µ½mysqlÏûºÄµÄcpuºÜ´ó£¬¿ÉÒÔÓ ......
Á¬½Ó´úÂë1Ö±½ÓÊäÈë
<%
Dim my_conn, sql,rs
Set my_conn = createobject("ADODB.Connection")
my_conn.open = "DRIVER={MySQL ODBC 3.51 Driver};"_
& "SERVER=localhost;"_ '·þÎñÆ÷Ãû
& "DATABASE=mybase;"_ 'Êý¾Ý¿âÃû
& "UID=root;PWD=111; OPTION=35;" 'Óû§ÃûºÍÃÜÂë
Set rs = Server.Crea ......
±³¾°£ºÄ³¸öϵͳµÄmysqlÊý¾Ý¿âdnname²ÉÓÃĬÈϵÄlatin1×Ö·û¼¯£¬ÏµÍ³Éý¼¶ÐèÒª½«ËùÓÐÊý¾Ýת»»³Éutf-8¸ñʽ£¬Ä¿±êÊý¾Ý¿âΪnewdbname(½¨¿âʱʹÓÃutf8)
·½·¨Ò»£º
²½ÖèÒ» ÃüÁîÐÐÖ´ÐУºmysqldump --opt -hlocalhost -uroot -p*** --default-character-set=lantin1 dbname > /usr/local/dbname.sql
²½Öè¶þ ½« dbname.s ......
Explain MySQL architecture
. - The front layer
takes care of network connections and security authentications, the
middle layer does the SQL query parsing, and then the query is handled
off to the storage engine. A storage engine could be either a default
one supp ......