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

sql Ö´ÐÐ˳Ðò

SQL SelectÓï¾äÍêÕûµÄÖ´ÐÐ˳Ðò
2009-06-02 15:57
SQL SelectÓï¾äÍêÕûµÄÖ´ÐÐ˳Ðò£º1¡¢from×Ó¾ä×é×°À´×Ô²»Í¬Êý¾ÝÔ´µÄÊý¾Ý£»2¡¢where×Ó¾ä»ùÓÚÖ¸¶¨µÄÌõ¼þ¶Ô¼Ç¼ÐнøÐÐɸѡ£»3¡¢group by×Ӿ佫Êý¾Ý»®·ÖΪ¶à¸ö·Ö×飻4¡¢Ê¹Óþۼ¯º¯Êý½øÐмÆË㣻5¡¢Ê¹ÓÃhaving×Ó¾äɸѡ·Ö×飻
ÒÔϽáÂÛÊÇͨ¹ýÔÚSql Server2000ÉϵÄʵÑéµÃ³öµÄ½áÂÛ£¬Ò²¿Éͨ¹ý²é¿´¹À¼ÆµÄÖ´Ðмƻ®£¨Ctrl+L£©À´²é¿´Ö´ÐÐ˳Ðò¡£ 1.ÏÈÖ´ÐеȺţ¨=£©×ó±ßÊDZäÁ¿µÄ±í´ïʽ£¨AÀࣩ£¬ÔÙÖ´ÐеȺţ¨=£©×ó±ßÊÇÁÐÃûµÄ±í´ïʽ£¨BÀࣩ¡£Àý£ºupdate tablename set columnName=@variable,@variable=@variable+1 ÏÈÖ´ÐÐ@variable=@variable+1£¬ÔÙÖ´ÐÐcolumnName=@variable 2.Èç¹ûÓжà¸öAÀࣨ»òBÀࣩ±í´ïʽ£¬°´´Ó×óµ½ÓÒ˳ÐòÖ´ÐÐAÀࣨ»òBÀࣩ±í´ïʽ¡£Àý£ºupdate tablename set columnName=@variable,@variable=@variable+1,@variable=2*@variable ÏÈÖ´ÐÐ@variable=@variable+1£¬ÔÙÖ´ÐÐ@variable=2*@variable£¬×îºóÖ´ÐÐcolumnName=@variable 3.ÁÐÃûËù´ú±íµÄÖµÓÀÔ¶ÊÇÔ­Öµ¡£Àý£ºupdate tablename set columnName=colunName+1,columnNameBa
group by
    ÔÚselect Óï¾äÖпÉÒÔʹÓÃgroup by ×Ӿ佫Ðл®·Ö³É½ÏСµÄ×飬Ȼºó£¬Ê¹ÓþÛ×麯Êý·µ»Øÿһ¸ö×éµÄ»ã×ÜÐÅÏ¢£¬ÁíÍ⣬¿ÉÒÔʹÓÃhaving×Ó¾äÏÞÖÆ·µ»ØµÄ½á¹û¼¯¡£group by ×Ó¾ä¿ÉÒÔ½«²éѯ½á¹û·Ö×飬²¢·µ»ØÐеĻã×ÜÐÅÏ¢Oracle °´ÕÕgroup by ×Ó¾äÖÐÖ¸¶¨µÄ±í´ïʽµÄÖµ·Ö×é²éѯ½á¹û¡£
   ÔÚ´øÓÐgroup by ×Ó¾äµÄ²éѯÓï¾äÖУ¬ÔÚselect ÁбíÖÐÖ¸¶¨µÄÁÐҪôÊÇgroup by ×Ó¾äÖÐÖ¸¶¨µÄÁУ¬ÒªÃ´°üº¬¾Û×麯Êý
   select max(sal),job emp group by job;
   (×¢Òâmax(sal),jobµÄjob²¢·ÇÒ»¶¨Òª³öÏÖ£¬µ«ÓÐÒâÒå)
   ²éѯÓï¾äµÄselect ºÍgroup by ,having ×Ó¾äÊǾÛ×麯ÊýΨһ³öÏֵĵط½£¬ÔÚwhere ×Ó¾äÖв»ÄÜʹÓþÛ×麯Êý¡£
select deptno,sum(sal) from emp where sal>1200 group by deptno having sum(sal)>8500 order by deptno;
µ±ÔÚgropu by ×Ó¾äÖÐʹÓÃhaving ×Ó¾äʱ£¬²éѯ½á¹ûÖÐÖ»·µ»ØÂú×ãhavingÌõ¼þµÄ×é¡£ÔÚÒ»¸ösqlÓï¾äÖпÉÒÔÓÐwhere×Ó¾äºÍhaving×Ӿ䡣having Óëwhere ×Ó¾äÀàËÆ£¬¾ùÓÃÓÚÉèÖÃÏÞ¶¨Ìõ¼þ
where ×Ó¾äµÄ×÷ÓÃÊÇÔÚ¶Ô²éѯ½á¹û½øÐзÖ×éÇ°£¬½«²»·ûºÏwhereÌõ¼þµÄÐÐÈ¥µô£¬¼´ÔÚ·Ö×é֮ǰ¹ýÂËÊý¾Ý£¬Ìõ¼þÖв»ÄÜ°üº¬¾Û×麯Êý£¬Ê¹ÓÃwhereÌõ¼þÏÔʾÌض¨µÄÐС£
having ×Ó¾äµÄ×÷ÓÃÊÇɸѡÂú×ãÌõ¼þµÄ×飬¼´ÔÚ·Ö×éÖ®ºó¹ýÂËÊý¾Ý£¬Ìõ¼


Ïà¹ØÎĵµ£º

´Ó¸÷ÖÖλÖýØÈ¡×Ö·û´®µÄSQLÓï·¨

Öª: ×Ö¶ÎA='F:\photo\Winter Leaves.jpg'  
ÒªÇó:·Ö¶Î½Øȡÿ¶Î×Ö·û[×Ö¶ÎA²»ÄÜΪTEXTÀàÐÍ,·ñÔò±¨´í]
½â¾ö·½·¨:
---½ØÈ¡×Ö·û´®AµÄµÚÒ»¸ö\×ó±ßµÄ×Ö·û´®
select left(A,charindex('/',A)-1)
Êä³ö½á¹û£ºF:
---½ØÈ¡\ÖмäµÄ×Ö·û´®
select  left(stuff(A,1,charindex('/',A),''),charindex('/',stuff(A,1,c ......

ORACLE PL/SQL×Ó³ÌÐò

ιʶø֪У¬¹ûÈ»Èç´Ëѽ£¬µÚ¶þ´ÎÔÙ·­¿ªÍ¬ÑùµÄÄÚÈݹûÈ»Óв»Í¬µÄÊÕ»ñ£¬ÓÐЩÊǵÚÒ»´Î¿´µÄʱºòûÓÐ×ÐϸÀí½âµÄ£¬»¹ÓÐЩ¿ÉÄÜÊÇÔÚµÚÒ»´Î¿´´Ò´Ò¾ÍÌø¹ýµÄ£¬µ±È»£¬¿ÉÄÜ»¹Óв¿·ÖÊÇ×Ô¼ºµ±Ê±¼ÇסÁËÍêÁËÓÖ¸øÍü¼ÇÁË¡£½ñÌìµÚ¶þ´Î¿´µ½×Ó³ÌÐòÕâÒ»Õ½ڣ¬·¢ÏÖÁËЩеÄÄÚÈÝ£¬ºÇºÇ¡£ÔÚÕâÀïÎÒ¾ÍдÏÂһЩ»ù±¾ÄÚÈݺÍÈÝÒ×Íü¼ÇµÄ£¬ÃâµÃÏ´ÎÓÖ¸øÍüÁË¡£ÄÚ ......

SQL Server CLRÈ«¹¦ÂÔÖ®¶þ

´ÓÕâÒ»½Ú¿ªÊ¼ÄØ£¬ÎÒÃǾÍÒª¿ªÊ¼CLRµÄ±à³ÌÖ®ÂÃÁË¡£ÔÚÕâ֮ǰ£¬ÎÒÏȰѱ¾½ÚÖÐÐèÒªÁ˽âµÄÁ½¸öÐÂÀàSqlDataRecordºÍSqlMetaData£¬¼°Îå¸öз½·¨SqlContext.Pipe.SendResultsStart£¬SqlContext.Pipe.SendResultsRow£¬SqlContext.Pipe.SendResultsEnd£¬SqlContext.Pipe.SendºÍSqlContext.Pipe.ExecuteAndSend½øÐÐһϱØÒªµÄ˵Ã÷£¬·½±ã´ ......

SQL Server 2008 й¦ÄÜ

SQL Server 2008 й¦ÄÜ
 
 ÓÃÓÚ¹ÜÀíµÄй¦ÄÜÓÐÄÄЩ£¿
¶ÔÓÚ¾­³£Òª¸ºÔð¹ÜÀí·Ö²¼ÔÚÊýʮ̨ÉõÖÁÊý°Ų̀·þÎñÆ÷ÖеÄÊýÒ԰ټƻòǧ¼ÆµÄ´óÐ͸´ÔÓÊý¾Ý¿â»·¾³µÄÊý¾Ý¿â¹ÜÀíÔ±¶øÑÔ£¬ÐµIJßÂÔ¹ÜÀí¡¢¶à·þÎñÆ÷²éѯ¹¦ÄÜ¡¢ÅäÖ÷þÎñÆ÷ÒÔ¼°Êý¾ÝÊÕ¼¯Æ÷/¹ÜÀí²Ö¿â¹¦ÄÜΪËûÃǸ³ÓèÁËÇ¿´óµÄÄÜÁ¦¡£
 
 ÓÃÓÚ¿ÉÉìËõÐÔµÄй¦ÄÜÓÐÄ ......

sqlʱ¼äº¯ÊýÏê½â

1.      µ±Ç°ÏµÍ³ÈÕÆÚ¡¢Ê±¼ä
        select getdate()
2. dateadd      ÔÚÏòÖ¸¶¨ÈÕÆÚ¼ÓÉÏÒ»¶Îʱ¼äµÄ»ù´¡ÉÏ£¬·µ»ØÐ嵀 datetime Öµ
       ÀýÈ磺ÏòÈÕÆÚ¼ÓÉÏ2Ìì
    &nbs ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ