- ©«¤l
- 20
- ¥DÃD
- 18
- ºëµØ
- 0
- ¿n¤À
- 43
- ÂI¦W
- 0
- §@·~¨t²Î
- windows xp
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2011-9-5
- ³Ì«áµn¿ý
- 2011-9-6
|
MySQL¶i¶¥_SELECT½g(¤@)
MySQL¤¤SELECT»y¥yªº°ò¥»»yªk¬O¡G
SELECT [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [HIGH_PRIORITY] [DISTINCT|DISTINCTROW|ALL] select_list [INTO {OUTFILE|DUMPFILE} 'file_name' export_options] [FROM table_references [WHERE where_definition] [GROUP BY col_name,...] [HAVING where_definition] [ORDER BY {unsighed_integer|col_name|formura} [ASC|DESC],...] [LIMIT [offset,] rows] [PROCEDURE procedure_name]]
±q³oÓ°ò¥»»yªk¥i¥H¬Ý¥X¡A³Ì²³æªº SELECT»y¥y¬OSELECT select_list¡A¹ê»Ú¤W§Q¥Î³oӳ̲³æªºSELECT»y¥y¡A§A¤]¥i¥H§¹¦¨³\¦h§A´Á«Ýªº¥\¯à¡Aº¥ý§A¯à§Q¥Î¥¦¶i¦æMySQL©Ò¤ä«ùªº¥ô¦ó¹Bºâ¡A¨Ò¦p¡GSELECT 1+1¡A¥¦±Nªð¦^2¡F¨ä¦¸¡A§A¤]¯à§Q¥Î¥¦µ¹Åܶq½áÈ¡A¦Ó¦bPHP¤¤¡A¹B¥ÎSELECT»y¥yªº³oºØ¥\¯à¡A§A´N¥i¥H¦Û¥Ñ¦a¹B¥ÎMySQLªº¨ç¼Æ¬°PHPµ{¦¡¶i¦æ¦UºØ¹Bºâ¡A¨Ã½áȵ¹Åܶq¡C¦b«Ü¦hªº®ÉÔ¡A§A·|µo²{MySQL¾Ö¦³³\¦h¤ñPHP§ó¬°¥\¯à±j¤jªº¨ç¼Æ¡C
STRAIGHT_JOIN¡BSQL_SMALL_RESULT¡BSQL_BIG_RESULT¡BHIGH_PRIORITY¬OMySQL¹ïANSI SQL92ªºÂX®i¡C¦pªGÀu¤Æ¾¹¥H«D³Ì¨Î¦¸§ÇÁpµ²ªí¡A¨Ï¥ÎSTRAIGHT_JOIN¥i¥H¥[§Ö¬d¸ß¡C
SQL_SMALL_RESULT ©MSQL_BIG_RESULT¬O¤@²Õ¬Û¹ïªºÃöÁäµü¡C¥¦Ì¥²¶·»PGROUP BY¡BDISTINCT©ÎDISTINCTROW¤@°_¨Ï¥Î¡CSQL_SMALL_RESULT§iª¾Àu¤Æ¾¹µ²ªG·|«Ü¤p¡An¨DMySQL¨Ï¥ÎÁ{®ÉªíÀx¦s³Ì²×ªºªí¦Ó¤£¬O¨Ï¥Î±Æ§Ç¡F¤Ï¤§¡ASQL_BIG_RESULT§iª¾Àu¤Æ¾¹µ²ªG·|«Ü¤p¡An¨DMySQL¨Ï¥Î±Æ§Ç¦Ó¤£¬O°µÁ{®Éªí¡C
HIGH_PRIORITY±N½á¤©SELECT¤ñ¤@Ó§ó·sªíªº»y¥y§ó°ªªºÀu¥ý¯Å¡A¨Ï¤§¥i¥H¶i¦æ¤@¦¸Àu¥ýªº§Ö³tªº¬d¸ß¡C
¥H¤W¥|ÓÃöÁäµüªº¨Ï¥Î¤èªkªº½T¤ñ¸û±âÀß¡C©¯¹Bªº¬O¡A¦bµ´¤j¦h¼Æ±¡ªp¤U¡A¦bMySQL¤¤§Ú̧¹¥þ¥i¥H¿ï¾Ü¤£¨Ï¥Î³o¥|ÓÃöÁäµü¡C
DISTINCT¡B DISTINCTROW¹ï¬d¸ßªð¦^ªºµ²ªG¶°´£¨Ñ¤F¤@ӳ̰ò¥»¦ý¬O«Ü¦³¥Îªº¹LÂo¡C¨º´N¬Oµ²ªG¶°¤¤¥u§t«D«½Æ¦æ¡C¦b³o¸Ìnª`·Nªº¬O¡A¹ïÃöÁäµü DISTINCT¡BDISTINCTROW¨Ó»¡¡AªÅȳ£¬O¬Ûµ¥ªº¡AµL½×¦³¦h¤ÖNULLÈ¡A¥u¿ï¾Ü¤@Ó¡C¦ÓALLªº¥Îªk´N¦³µe³D²K¨¬¤§¶û¤F¡C¥¦¹ïµ²ªG¶°ªº²£¥Í¨S¦³¥ô¦ó¼vÅT¡C
INTO {OUTFILE|DUMPFILE} 'file_name' export_options¡A±Nµ²ªG¶°¼g¤J¤@Ó¤å¥ó¡C¤å¥ó¦bªA°È¾¹¥D¾÷¤W³Q·s¼W¡A¨Ã¥B¤£¯à¬O¤w¸g¦s¦bªº¡C»y¥y¤¤ªºexport_options³¡¤Àªº»yªk»P¥Î¦bLOAD DATAINFILE»y¥y¤¤ªºFIELDS©MLINES¤l¥y¤¤ªº¬Û¦P¡A§Ú̱N¦bMySQL¶i¶¥_LOAD DATA½g¤¤¸Ô²Ó°Q½×¥¦¡C¦ÓOUTFILE»PDUMPFILEªºÃöÁä¦rªº°Ï§O¬O¡G«á«e¥u¼g¤@¦æ¨ì¤å¥ó¡A¨Ã¨S¦³¥ô¦ó¦C©Î¦æµ²§ô¡C
Âà¦Û¡G |
|