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

mysqlÃüÁîÐÐ HAVING×Ó¾ä UNION

ÎÒÔÚmysql ÃüÁîÐÐÕâ¸öϵÁÐÀï½éÉܹýÓÐÌõ¼þ²éѯ£¬ËüÓõ½WHERE×Ӿ䡣µ«ÊÇÓÐʱºòÓÃWHERE×Ó¾äÎÞ·¨¸øÎÒÃǵIJéѯ¼ÓÈëÌõ¼þ£¬±ÈÈçÔÚÉÏÒ»½ÚÎÒÃÇѧϰµÄGROUP BY(°´×é¹éÀà)×Ӿ䣬Èç¹ûÎÒÃÇÒªÔÚ°´×é¹éÀàºó¼ÓÈëÌõ¼þ£¬ÓÃWHERE¾ÍÐв»Í¨£¬ÒòΪWHEREÖ»¿ÉÒÔÔÚ°´×é¹éÀàÇ°¼ÓÈëÌõ¼þ¡£ºÃÔÚmysqlÌṩHAVING×Ӿ䣬Ëü¿ÉÒÔ°ïÎÒÃǽâ¾öÕâ¸öÎÊÌâ¡£
ÈçºÎʹÓÃHAVING×Ӿ䣿
Ê×ÏÈ£¬ÈÃÎÒÃÇ¿´Ò»¸öGROUP BY(°´×é¹éÀà)µÄ×Ó¾äÓ¦Óãº
select title, AVG(salary)
from employee_data
GROUP BY title;
+----------------------------+-------------+
| title | AVG(salary) |
+----------------------------+-------------+
| CEO | 200000.0000 |
| Customer Service Manager | 70000.0000 |
| Finance Manager | 120000.0000 |
| Marketing Executive | 77333.3333 |
| Multimedia Programmer | 83333.3333 |
| Programmer | 75000.0000 |
| Senior Marketing Executive | 120000.0000 |
| Senior Programmer | 115000.0000 |
| Senior Web Designer | 110000.0000 |
| System Administrator | 95000.0000 |
| Web Designer | 87500.0000 |
+----------------------------+-------------+
11 rows in set (0.00 sec)
ÉÏÊöÀý×Ó°ÑÔ±¹¤Ö°Îñ°´×é·ÖÀಢÇҰѸ÷¸öÖ°ÎñµÄƽ¾ù¹¤×ÊÁгö¡£Èç¹ûÎÒÃÇÖ»ÏëÁгöƽ¾ù¹¤×Ê´óÓÚ100000µÄÖ°Îñ£¬¾ÍÒªÓõ½HAVING×Ӿ䣬ÈçÏ£º
select title, AVG(salary)
from employee_data
GROUP BY title
HAVING AVG(salary) > 100000;
+----------------------------+-------------+
| title | AVG(salary) |
+----------------------------+-------------+
| CEO | 200000.0000 |
| Finance Manager | 120000.0000 |
| Senior Marketing Executive | 120000.0000 |
| Senior Programmer | 115000.0000 |
| Senior Web Designer | 110000.0000 |
+----------------------------+-------------+
5 rows in set (0.00 sec)
×¢ÒâÔÚÕâÖÖÇé¿öÏ£¬ÓÃWHERE×Ó¾äÊÇÐв»Í¨µÄ£¡
MySQLÖÐUNION
 
ÔÚÊý¾Ý¿âÖУ¬UNIONºÍUNION ALL¹Ø¼ü×Ö¶¼Êǽ«Á½¸ö½á¹û¼¯ºÏ²¢ÎªÒ»¸ö£¬µ«ÕâÁ½Õß´ÓʹÓúÍЧÂÊÉÏÀ´Ëµ¶¼ÓÐËù²»Í¬¡£
MySQLÖеÄUNION
UNION Ô


Ïà¹ØÎĵµ£º

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

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

mysql replication


<!--
/* Font Definitions */
@font-face
{font-family:Courier;
panose-1:2 7 4 9 2 2 5 2 4 4;
mso-font-alt:"Courier New";
mso-font-charset:0;
mso-generic-font-family:modern;
mso-font-format:other;
mso-font-pitch:fixed;
mso-font-signature:3 0 0 0 1 0;}
@font-face
{f ......

WEB³ÌÐòÔ±ÐèÒªÕÆÎÕµÄÊ®´óMySQLÓÅ»¯¼¼ÇÉ

1.ÓÅ»¯ÄãµÄMySQL²éѯ»º´æ
ÔÚMySQL·þÎñÆ÷ÉϽøÐвéѯ£¬¿ÉÒÔÆôÓøßËÙ²éѯ»º´æ¡£ÈÃÊý¾Ý¿âÒýÇæÔÚºǫ́ÇÄÇĵĴ¦ÀíÊÇÌá¸ßÐÔÄܵÄ×îÓÐЧ·½·¨Ö®Ò»¡£µ±Í¬Ò»¸ö²éѯ±»Ö´Ðжà´Îʱ£¬Èç¹û½á¹ûÊÇ´Ó»º´æÖÐÌáÈ¡£¬ÄÇÊÇÏ൱¿ìµÄ¡£
µ«Ö÷ÒªµÄÎÊÌâÊÇ£¬ËüÊÇÄÇôÈÝÒ×±»Òþ²ØÆðÀ´ÒÔÖÁÓÚÎÒÃÇ´ó¶àÊý³ÌÐòÔ±»áºöÂÔËü¡£ÔÚÓÐЩ´¦ÀíÈÎÎñÖУ¬ÎÒÃÇʵ¼ÊÉÏÊÇ¿ÉÒÔ×è ......

Linux Ï MysqlÅäÖÃÎÊÌ⼯

Ò»Ö±ÒÔÀ´ÎÒµÄÎÄÕ¶¼ÊÇÒÔ¹¤×÷±Ê¼ÇµÄÐÎʽ´æÔÚ¡£Õâ¶ÔÓÚ×Ô¼º¶ÁÆðÀ´Ã»Ê²Ã´´ó°­£¬µ«ÊǶÔÓÚÆäËû¶ÁÕß¿ÉÄܾÍÓÐЩÃÔã¡£ÎÒ¾¡Á¿¸Ä¸Ä£¬»»ÖÖ·½Ê½¡£
1. MySQL µÄ°æ±¾
Èç¹ûÒªÖ§³Ö·ÖÇø±í£¬ÔòÓ¦¸ÃʹÓà5.1.x ÒÔÉϵİ汾¡£Èç
mysql> show variables like '%version%';
+-------------------------+------------------------------ ......

Struts+Hibernate+MySqlÖÐÎÄÂÒÂë½â¾ö·½°¸

1¡¢ÐÞ¸ÄMySqlÊý¾Ý¿âµÄmy.iniÅäÖÃÎļþ¡¢
# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If yo ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ