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

mysqlÓÅ»¯¼¼ÇÉ

1¡¢Ñ¡È¡×îÊÊÓõÄ×Ö¶ÎÊôÐÔ
MySQL ¿ÉÒԺܺõÄÖ§³Ö´óÊý¾ÝÁ¿µÄ´æÈ¡£¬µ«ÊÇÒ»°ã˵À´£¬Êý¾Ý¿âÖеıíԽС£¬ÔÚËüÉÏÃæÖ´ÐеIJéѯҲ¾Í»áÔ½¿ì¡£Òò´Ë£¬ÔÚ´´½¨±íµÄʱºò£¬ÎªÁË»ñµÃ¸üºÃµÄÐÔÄÜ£¬ÎÒÃÇ¿ÉÒÔ½«±íÖÐ×ֶεĿí¶ÈÉèµÃ¾¡¿ÉÄÜС¡£ÀýÈ磬ÔÚ¶¨ÒåÓÊÕþ±àÂëÕâ¸ö×Ö¶Îʱ£¬Èç¹û½«ÆäÉèÖÃΪCHAR(255),ÏÔÈ»¸øÊý¾Ý¿âÔö¼ÓÁ˲»±ØÒªµÄ¿Õ¼ä£¬ÉõÖÁʹÓÃVARCHARÕâÖÖÀàÐÍÒ²ÊǶàÓàµÄ£¬ÒòΪCHAR(6)¾Í¿ÉÒԺܺõÄÍê³ÉÈÎÎñÁË¡£Í¬ÑùµÄ£¬Èç¹û¿ÉÒԵĻ°£¬ÎÒÃÇÓ¦¸ÃʹÓÃMEDIUMINT¶ø²»ÊÇBIGINÀ´¶¨ÒåÕûÐÍ×ֶΡ£
ÁíÍâÒ»¸öÌá¸ßЧÂʵķ½·¨ÊÇÔÚ¿ÉÄܵÄÇé¿öÏ£¬Ó¦¸Ã¾¡Á¿°Ñ×Ö¶ÎÉèÖÃΪNOT NULL£¬ÕâÑùÔÚ½«À´Ö´ÐвéѯµÄʱºò£¬Êý¾Ý¿â²»ÓÃÈ¥±È½ÏNULLÖµ¡£
¶ÔÓÚijЩÎı¾×ֶΣ¬ÀýÈç“Ê¡·Ý”»òÕß“ÐԱ𔣬ÎÒÃÇ¿ÉÒÔ½«ËüÃǶ¨ÒåΪENUMÀàÐÍ¡£ÒòΪÔÚMySQLÖУ¬ENUMÀàÐͱ»µ±×÷ÊýÖµÐÍÊý¾ÝÀ´´¦Àí£¬¶øÊýÖµÐÍÊý¾Ý±»´¦ÀíÆðÀ´µÄËÙ¶ÈÒª±ÈÎı¾ÀàÐÍ¿ìµÃ¶à¡£ÕâÑù£¬ÎÒÃÇÓÖ¿ÉÒÔÌá¸ßÊý¾Ý¿âµÄÐÔÄÜ¡£
2¡¢Ê¹ÓÃÁ¬½Ó£¨JOIN£©À´´úÌæ×Ó²éѯ(Sub-Queries)
MySQL ´Ó4.1¿ªÊ¼Ö§³ÖSQLµÄ×Ó²éѯ¡£Õâ¸ö¼¼Êõ¿ÉÒÔʹÓÃSELECTÓï¾äÀ´´´½¨Ò»¸öµ¥ÁеIJéѯ½á¹û£¬È»ºó°ÑÕâ¸ö½á¹û×÷Ϊ¹ýÂËÌõ¼þÓÃÔÚÁíÒ»¸ö²éѯÖС£ÀýÈ磬ÎÒÃÇÒª½«¿Í»§»ù±¾ÐÅÏ¢±íÖÐûÓÐÈκζ©µ¥µÄ¿Í»§É¾³ýµô£¬¾Í¿ÉÒÔÀûÓÃ×Ó²éѯÏÈ´ÓÏúÊÛÐÅÏ¢±íÖн«ËùÓз¢³ö¶©µ¥µÄ¿Í»§IDÈ¡³öÀ´£¬È»ºó½«½á¹û´«µÝ¸øÖ÷²éѯ£¬ÈçÏÂËùʾ£º
DELETE from customerinfo
WHERE CustomerID NOT in (SELECT CustomerID from salesinfo )
ʹÓÃ×Ó²éѯ¿ÉÒÔÒ»´ÎÐÔµÄÍê³ÉºÜ¶àÂß¼­ÉÏÐèÒª¶à¸ö²½Öè²ÅÄÜÍê³ÉµÄSQL²Ù×÷£¬Í¬Ê±Ò²¿ÉÒÔ±ÜÃâÊÂÎñ»òÕß±íËøËÀ£¬²¢ÇÒдÆðÀ´Ò²ºÜÈÝÒס£µ«ÊÇ£¬ÓÐЩÇé¿öÏ£¬×Ó²éѯ¿ÉÒÔ±»¸üÓÐЧÂʵÄÁ¬½Ó£¨JOIN£©.. Ìæ´ú¡£ÀýÈ磬¼ÙÉèÎÒÃÇÒª½«ËùÓÐûÓж©µ¥¼Ç¼µÄÓû§È¡³öÀ´£¬¿ÉÒÔÓÃÏÂÃæÕâ¸ö²éѯÍê³É£º
SELECT * from customerinfo
WHERE CustomerID NOT in (SELECT CustomerID from salesinfo )
Èç¹ûʹÓÃÁ¬½Ó£¨JOIN£©.. À´Íê³ÉÕâ¸ö²éѯ¹¤×÷£¬ËٶȽ«»á¿ìºÜ¶à¡£ÓÈÆäÊǵ±salesinfo±íÖжÔCustomerID½¨ÓÐË÷ÒýµÄ»°£¬ÐÔÄܽ«»á¸üºÃ£¬²éѯÈçÏ£º
SELECT * from customerinfo
LEFT JOIN salesinfoON customerinfo.CustomerID=salesinfo.
CustomerID
WHERE salesinfo.CustomerID IS NULL
Á¬½Ó£¨JOIN£©.. Ö®ËùÒÔ¸üÓÐЧÂÊһЩ£¬ÊÇÒòΪ MySQL²»ÐèÒªÔÚÄÚ´æÖд´½¨ÁÙʱ±íÀ´Íê³ÉÕâ¸öÂß¼­ÉϵÄÐèÒªÁ½¸ö²½ÖèµÄ²éѯ¹¤×÷¡£
3¡¢Ê¹ÓÃÁªºÏ(UNION)À´´úÌæÊÖ¶¯´´½¨µÄÁÙʱ±í
MySQL ´Ó 4.0 µÄ°æ±¾¿ªÊ¼Ö§³Ö UNION ²éÑ


Ïà¹ØÎĵµ£º

Mysql ¹Ø¼ü×Ö ±£Áô×Ö

Mysql ¹Ø¼ü×Ö-±£Áô×Ö
ÔÚpowerdesignerÉè¼ÆµÄʱºòÓÃÁ˹ؼü×Ö£¬Éú³É³ö´í£¬ºÜ囧¡£¡£¡£
 
 
 
 
 
ADD
ALL
ALTER
ANALYZE
AND
AS
ASC
ASENSITIVE
BEFORE
BETWEEN
BIGINT
BINARY
BLOB
BOTH
BY
CALL
CASCADE
CASE
CHANGE
CHAR
CHARACTER
CHECK
COLLATE
COLUMN
CON ......

½â¾ö.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 ÃüÁîʹÓÃ

mysql ÃüÁîѧϰ£º
1. mysql -uroot  ;
2.mysql -h ip -ubusiusr -pbusiusr newdrmdb;
3.show databases ;                 //ÏÔʾËùÓеÄÊý¾Ý¿â ;
4.show tables ;           ......

ubuntu MySQL°²×°Ö¸ÄÏ

°²×° MySQL£¬¿ÉÒÔÔÚÖÕ¶ËÌáʾ·ûºóÔËÐÐÏÂÁÐÃüÁ
sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install php5-mysql
// °²×°php5-mysql Êǽ«phpºÍmysqlÁ¬½ÓÆðÀ´
Ò»µ©°²×°Íê³É£¬MySQL ·þÎñÆ÷Ó¦¸Ã×Ô¶¯Æô¶¯¡£Äú¿ÉÒÔÔÚÖÕ¶ËÌáʾ·ûºóÔËÐÐÒÔÏÂÃüÁîÀ´¼ì²é MySQL ·þÎñÆ÷ÊÇ·ñÕýÔÚÔËÐУº
s ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ