(תÔØ)MySQLÖÐUNIONºÍUNION ALLµÄÇø±ð
ÔÚÊý¾Ý¿â
ÖУ¬UNION
ºÍUNION
ALL
¹Ø¼ü×Ö¶¼Êǽ«Á½¸ö½á¹û¼¯ºÏ²¢ÎªÒ»¸ö£¬µ«ÕâÁ½Õß´ÓʹÓúÍЧ
ÂÊÉÏÀ´Ëµ¶¼ÓÐËù²»Í¬¡£
MySQL
ÖÐ
µÄUNION
UNIONÔÚ½øÐбíÁ´½Óºó»áɸѡµôÖظ´µÄ¼Ç¼£¬ËùÒÔÔÚ±íÁ´½Óºó»á¶ÔËù²úÉúµÄ½á¹û¼¯½øÐÐÅÅÐòÔËË㣬ɾ³ýÖظ´µÄ¼Ç¼ÔÙ
·µ»Ø½á¹û¡£Êµ¼Ê´ó²¿·ÖÓ¦ÓÃÖÐÊDz»»á²úÉúÖظ´µÄ¼Ç¼£¬×î³£¼ûµÄÊǹý³Ì±íÓëÀúÊ·±íUNION¡£È磺
select * from gc_dfys union select * from
ls_jg_dfys
Õâ¸öSQLÔÚÔËÐÐʱÏÈÈ¡³öÁ½¸ö±íµÄ½á¹û£¬ÔÙÓÃÅÅÐò¿Õ¼ä½øÐÐÅÅÐòɾ³ýÖظ´µÄ¼Ç¼£¬
×îºó·µ»Ø½á¹û¼¯£¬Èç¹û±íÊý¾ÝÁ¿´óµÄ»°¿ÉÄܻᵼÖÂÓôÅÅ̽øÐÐÅÅÐò¡£
MySQL
ÖеÄUNION ALL
¶øUNION
ALLÖ»ÊǼòµ¥µÄ½«Á½¸ö½á¹ûºÏ²¢ºó¾Í·µ»Ø¡£ÕâÑù£¬Èç¹û·µ»ØµÄÁ½¸ö½á¹û¼¯ÖÐÓÐÖظ´µÄÊý¾Ý£¬ÄÇô·µ»ØµÄ½á¹û¼¯¾Í»á°üº¬Öظ´µÄÊý¾ÝÁË¡£
´ÓЧÂÊÉÏ
˵£¬UNION ALL Òª±ÈUNION¿ìºÜ¶à£¬ËùÒÔ£¬Èç¹û¿ÉÒÔÈ·ÈϺϲ¢µÄÁ½¸ö½á¹û¼¯Öв»°üº¬Öظ´µÄÊý¾ÝµÄ»°£¬ÄÇô¾ÍʹÓÃUNION ALL£¬ÈçÏ£º
select * from gc_dfys
union all select * from ls_jg_dfys
TAG:
mysql
MySQL
Mysql
UNION
ALL
Ïà¹ØÎĵµ£º
±¸·ÝÊý¾Ý¿âÃüÁî:
mysqldump -u root --password=root --database helloworld
>helloworld_backup.sql
ÆäËûÓ÷¨:
1.µ¼³öÕû¸öÊý¾Ý¿â
mysqldump -u Óû§Ãû -p Êý¾Ý¿âÃû > µ¼³öµÄÎļþÃû
mysqldump -u wcnc -p smgp_apps_wcnc > wcnc.sql
2.µ¼³öÒ»¸ö±í
mysqldump -u Óû§Ãû -p Êý¾Ý¿âà ......
Scale Out£ººáÏòÀ©Õ¹£¬Ôö¼Ó´¦Àí½ÚµãÌá¸ßÕûÌå´¦ÀíÄÜÁ¦
Scale Up£º×ÝÏòÀ©Õ¹£¬Í¨¹ýÌáÉýµ¥¸ö½ÚµãµÄ´¦ÀíÄÜÁ¦´ïµ½ÌáÉýÕûÌå´¦ÀíÄÜÁ¦µÄÄ¿µÄ
Replication
MySQLµÄreplicationÊÇÒì²½µÄ£¬ÊÊÓÃÓÚ¶ÔÊý¾ÝʵʱÐÔÒªÇó²»ÊÇÌرð¹Ø¼üµÄ³¡¾°¡£slave¶ËµÄIOÏ̸߳ºÔð´Ómaster¶ÁÈ¡ÈÕÖ¾£¬SQLÏß ³ÌרߺÔðÔÚslave¶ËÓ¦ÓôÓmaster¶Á¹ýÀ´µÄÈÕÖ¾£¨ÔçÆÚ ......
·ÅÔÚÕâÀﱸÍü,ÀÏÊÇÍü¼ÇÔõôд¡£
mysql> create database book;
mysql> use book;
Database changed
mysql> create table email_message(key_mail_messages INTEGER,
-> date_created VARCHAR(19),
-> date_updated varchar(19),
-> date_email varchar(19),
-> addr_from va ......
ʹÓÃPorts·½Ê½ÔÚFreeBSDÏÂÅäÖÃMySQL,Apache,PHP
ÓôÃÆÁ˺ü¸Ìì,ÖÕÓÚÔÚFreeBSDϽ«MySQL,Apache,PHPµÄ»·¾³ÅàÖ²ºÃÁË.ϱ߰ÑÅäÖò½ÖèºÍ×¢ÒâµãÂÞÁÐÔÚϱß,ºÍ´ó¼Ò·ÖÏí.
FreeBSD°æ±¾ÊÇ7.3,MySQL°æ±¾ÊÇ5.0.90,Apache°æ±¾ÊÇ2.2.14£¨1.3.42£©,PHP°æ±¾ÊÇ5.2.12.Îҵݲװ˳ÐòÊÇÏÈMySQL,È»ºó°²×°ApacheºÍPHP,Ò»°ãÊÇ°²×°Í ......