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

SQLÖÐonÌõ¼þÓëwhereÌõ¼þµÄÇø±ð (having)

 
 
SQLÖÐonÌõ¼þÓëwhereÌõ¼þµÄÇø±ð
      Êý¾Ý¿âÔÚͨ¹ýÁ¬½ÓÁ½ÕÅ»ò¶àÕűíÀ´·µ»Ø¼Ç¼ʱ£¬¶¼»áÉú³ÉÒ»ÕÅÖмäµÄÁÙʱ±í£¬È»ºóÔÙ½«ÕâÕÅÁÙʱ±í·µ»Ø¸øÓû§¡£
     ÔÚʹÓÃleft jionʱ£¬onºÍwhereÌõ¼þµÄÇø±ðÈçÏ£º
1¡¢ onÌõ¼þÊÇÔÚÉú³ÉÁÙʱ±íʱʹÓõÄÌõ¼þ£¬Ëü²»¹ÜonÖеÄÌõ¼þÊÇ·ñΪÕ棬¶¼»á·µ»Ø×ó±ß±íÖеļǼ¡£
2¡¢whereÌõ¼þÊÇÔÚÁÙʱ±íÉú³ÉºÃºó£¬ÔÙ¶ÔÁÙʱ±í½øÐйýÂ˵ÄÌõ¼þ¡£ÕâʱÒѾ­Ã»ÓÐleft joinµÄº¬Ò壨±ØÐë·µ»Ø×ó±ß±íµÄ¼Ç¼£©ÁË£¬Ìõ¼þ²»ÎªÕæµÄ¾ÍÈ«²¿¹ýÂ˵ô¡£
      ¼ÙÉèÓÐÁ½ÕÅ±í£º
±í1£ºtab2
id
size
1
10
2
20
3
30
±í2£ºtab2
size
name
10
AAA
20
BBB
20
CCC
Á½ÌõSQL:
1¡¢select * form tab1 left join tab2 on (tab1.size = tab2.size) where tab2.name=’AAA’
2¡¢select * form tab1 left join tab2 on (tab1.size = tab2.size and tab2.name=’AAA’)
µÚÒ»ÌõSQLµÄ¹ý³Ì£º
1¡¢Öмä±í
onÌõ¼þ:
tab1.size = tab2.size
tab1.id
tab1.size
tab2.size
tab2.name
1
10
10
AAA
2
20
20
BBB
2
20
20
CCC
3
30
(null)
(null)
|
|
2¡¢ÔÙ¶ÔÖмä±í¹ýÂË
where Ìõ¼þ£º
tab2.name=’AAA’
tab1.id
tab1.size
tab2.size
tab2.name
1
10
10
AAA
 
 
µÚ¶þÌõSQLµÄ¹ý³Ì£º
1¡¢Öмä±í
onÌõ¼þ:
tab1.size = tab2.size and tab2.name=’AAA’
(Ìõ¼þ²»ÎªÕæÒ²»á·µ»Ø×ó±íÖеļǼ)
tab1.id
tab1.size
tab2.size
tab2.name
1
10
10
AAA
2
20
(null)
(null)
3
30
(null)
(null)
     ÆäʵÒÔÉϽá¹ûµÄ¹Ø¼üÔ­Òò¾ÍÊÇleft join,right join,full joinµÄÌØÊâÐÔ£¬²»¹ÜonÉϵÄÌõ¼þÊÇ·ñΪÕ涼»á·µ»Øleft»òright±íÖеļǼ£¬fullÔò¾ßÓÐleftºÍrightµÄÌØÐԵIJ¢¼¯¡£ ¶øinner jionûÕâ¸öÌØÊâÐÔ£¬ÔòÌõ¼þ·ÅÔÚonÖкÍwhereÖУ¬·µ»ØµÄ½á¹û¼¯ÊÇÏàͬµÄ¡£
on¡¢where¡¢havingµÄÇø±ð
2007-03-14 16:02
on¡¢where¡¢havingÕâÈý¸ö¶¼¿ÉÒÔ¼ÓÌõ¼þµÄ×Ó¾äÖУ¬onÊÇ×îÏÈÖ´ÐУ¬where´ÎÖ®£¬having×îºó¡£ÓÐʱºòÈç¹ûÕâÏȺó˳Ðò²»Ó°ÏìÖмä½á¹ûµÄ»°£¬ÄÇ×îÖÕ½á¹ûÊÇÏàͬµÄ¡£µ«ÒòΪonÊÇÏȰѲ»·ûºÏÌõ¼þµÄ¼Ç¼¹ýÂ˺ó²Å½øÐÐͳ¼Æ£¬Ëü¾Í¿ÉÒÔ¼õÉÙÖмäÔËËãÒª´¦ÀíµÄÊý¾Ý£¬°´Àí˵Ӧ¸ÃËÙ¶ÈÊÇ×î¿ìµÄ¡£   
    
 


Ïà¹ØÎĵµ£º

SQL SERVER Ò×»ìÏýµÄÊý¾ÝÀàÐÍ

 (1)char¡¢varchar¡¢textºÍnchar¡¢nvarchar¡¢ntext
charºÍvarcharµÄ³¤¶È¶¼ÔÚ1µ½8000Ö®¼ä£¬ËüÃǵÄÇø±ðÔÚÓÚcharÊǶ¨³¤×Ö·ûÊý¾Ý£¬¶øvarcharÊDZ䳤×Ö·ûÊý¾Ý¡£Ëùν¶¨³¤¾ÍÊdz¤¶È¹Ì¶¨ µÄ£¬µ±ÊäÈëµÄÊý¾Ý³¤¶ÈûÓдﵽָ¶¨µÄ³¤¶Èʱ½«×Ô¶¯ÒÔÓ¢ÎÄ¿Õ¸ñÔÚÆäºóÃæÌî³ä£¬Ê¹³¤¶È´ïµ½ÏàÓ¦µÄ³¤¶È£»¶ø±ä³¤×Ö·ûÊý¾ÝÔò²»»áÒÔ¿Õ¸ñÌî³ä¡£ text´ ......

×Ô¶¯¶¨Ê±ÖØÆôsql server»ØÊÕÄÚ´æ

¡¡×î½üΪÊý¾Ý¿â·þÎñÆ÷Ôö¼ÓÁËÄڴ棬´ïµ½ÁË×î´óÖ§³ÖµÄ8G£¬Êý¾Ý¿âÓõÄÊÇmssql 2005 £¬Ö®Ç°ÄÚ´æÒ»Ö±ÊÇ4GµÄ£¬²»´æÔÚÄÚ´æ´óºÍ32λ²Ù×÷ϵͳ³åÍ»µÄÊÂÇ飬32λ²Ù×÷ϵͳµ¥½ø³Ì×î´óÖ§³Ö2GµÄÄڴ棬ÕâÑù×ӵĻ°ÄÚ´æ¾Í°×¼ÓÁË£¬Ôõô°ìÄØ?
¡¡¡¡ÍøÉÏËÑË÷Á˺ܶà×ÊÁÏ£¬·¢ÏÖ΢ÈíÌṩÁËÒ»¸öËãÊÇÁÙʱµÄ½â¾ö·½°¸°É£¬Ê¹ÓÃAWEÀ´·ÖÅäÄڴ棬ÕâÑù×Ósqlse ......

SQLÖÐsaµÇ¼ʧ°Ü


MS-SQLÖÐsaµÇ¼ʧ°Ü:
¸Ã´íÎó²úÉúµÄÔ­ÒòÊÇÓÉÓÚSQL ServerʹÓÃÁË"½ö Windows"µÄÉí·ÝÑéÖ¤·½Ê½,
Òò´ËÓû§ÎÞ·¨Ê¹ÓÃSQL ServerµÄµÇ¼ÕÊ»§£¨Èç sa £©½øÐÐÁ¬½Ó.½â¾ö·½·¨ÈçÏÂËùʾ:
1.ÔÚ·þÎñÆ÷¶ËʹÓÃÆóÒµ¹ÜÀíÆ÷,²¢ÇÒÑ¡Ôñ"ʹÓà Windows Éí·ÝÑéÖ¤"Á¬½ÓÉÏ SQL Server
²Ù×÷²½Öè:
ÔÚÆóÒµ¹ÜÀíÆ÷ÖÐ
--ÓÒ¼üÄãµÄ·þÎñÆ÷ʵÀý(¾ÍÊÇÄÇ ......

sql³£ÓÃÓï¾äËÙ²éÊÖ²á

 Ò»¡¢»ù´¡
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE DATABASE database-name
2¡¢ËµÃ÷£ºÉ¾³ýÊý¾Ý¿â
drop database dbname
3¡¢ËµÃ÷£º±¸·Ýsql server
--- ´´½¨ ±¸·ÝÊý¾ÝµÄ device
USE master
EXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNwind_1.dat'
--- ¿ªÊ¼ ±¸·Ý
BACKUP DATABASE pubs TO testBack ......

ÔõÑù¶ÔSQL Server 2005¼ÓÃܵĴ洢¹ý³Ì½øÐнâÃÜ

 SQLServer2005ÀïʹÓÃwith encryptionÑ¡Ïî´´½¨µÄ´æ´¢¹ý³ÌÈÔÈ»ºÍsqlserver2000ÀïÒ»Ñù£¬¶¼ÊÇʹÓÃXOR½øÐÐÁ˵ļÓÃÜ¡£ºÍ2000²»Ò»ÑùµÄÊÇ£¬ÔÚ2005µÄϵͳ ±ísyscommentsÀïÒѾ­²é²»µ½¼ÓÃܹýµÄÃÜÎÄÁË¡£Òª²éÃÜÎıØÐëʹÓÃDAC(רÓùÜÀíÔ±Á¬½Ó)Á¬½Óµ½Êý¾Ý¿âºó£¬ÔÚϵͳ±í sys.sysobjvalues²éѯ£¬¸Ã±íµÄÁÐimageval´æ´¢ÁËÏàÓ¦µÄÃÜÎÄ¡£¾ß ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ