Sql Server¸ù¾Ý¼Ç¼¼¯ÅúÁ¿¸üÐÂÊý¾Ý¿â
update t1 set t1.value=t2.value from t2 where t1.id=t2.id
update jbsite_class set topicnum = count
from (select t2.classid,count from (
select distinct classid,count(*) as count
from jbsite_product
group by classid) t2
inner join jbsite_product on jbsite_product.id = t2.classid
) b where jbsite_class.id=b.classid
Ïà¹ØÎĵµ£º
What is SQL*Plus and where does it come from?
SQL*Plus is a command line SQL and PL/SQL language interface and reporting tool that ships with the Oracle Database Client and Server software. It can be used interactively or driven from scripts. SQL*Plus is frequently used by DBAs and Developers ......
Oracleά»¤³£ÓÃSQLÓï¾ä»ã×Ü
ÉÏһƪ / ÏÂһƪ 2008-09-04 11:25:01
²é¿´( 1991 ) / ÆÀÂÛ( 0 ) / ÆÀ·Ö( 0 / 0 )
ÈçºÎÔ¶³ÌÅжÏOracleÊý¾Ý¿âµÄ°²×°Æ½Ì¨
select * from v$version;
²é¿´±í¿Õ¼äµÄʹÓÃÇé¿ö
select sum(bytes)/(1024*1024) as free_space,tablespace_name
from dba_free_space
group by tablespace_ ......
sql ²éѯÌõ¼þ×Ö¶ÎΪtext»òntextµÃ½â¾ö·½°¸ÒÔ¼°varchar(max)¡¢nvarchar(max)
1¡¢ÔÚMS SQL2005¼°ÒÔÉϵİ汾ÖУ¬¼ÓÈë´óÖµÊý¾ÝÀàÐÍ£¨varchar(max)¡¢nvarchar(max)¡¢varbinary(max) £©¡£´óÖµÊý¾ÝÀàÐÍ×î¶à¿ÉÒÔ´æ´¢2^30-1¸ö×Ö½ÚµÄÊý¾Ý¡£
Õ⼸¸öÊý¾ÝÀàÐÍÔÚÐÐΪÉϺͽÏСµÄÊý¾ÝÀàÐÍ varchar¡¢nvarchar ºÍ varbinary Ïàͬ¡£
΢ÈíµÄË ......
Ò»¡¢ ½¨Á¢Ò»¸ö°²È«³éÏó²ã
¡¡¡¡ÎÒÃDz¢²»½¨ÒéÄãÊÖ¹¤µØ°ÑÇ°Ãæ½éÉܵļ¼ÊõÓ¦ÓÃÓÚÿһ¸öÓû§ÊäÈëµÄʵÀýÖУ¬¶øÊÇÇ¿ÁÒÍÆ¼öÄãΪ´Ë´´½¨Ò»¸ö³éÏó²ã¡£Ò»¸ö¼òµ¥µÄ³éÏóÊǰÑÄãµÄУÑé·½°¸¼ÓÈëµ½Ò»¸öº¯ÊýÖУ¬²¢ÇÒÕë¶ÔÓû§ÊäÈëµÄÿһÏîµ÷ÓÃÕâ¸öº¯Êý¡£µ±È»£¬ÎÒÃÇ»¹¿ÉÒÔ´´½¨Ò»ÖÖ¸ü¸´Ôӵĸü¸ßÒ»¼¶µÄ³éÏó-°ÑÒ»¸ö°²È«µÄ²éѯ·â×°µ½Ò»¸öÀàÖУ¬´Ó¶øÓ¦ ......
1.·ÖÒ³·½°¸Ò»£º(ÀûÓÃNot InºÍSELECT TOP·ÖÒ³)
¡¡¡¡Óï¾äÐÎʽ£º
SELECTTOP10*fromTestTableWHERE(IDNOTIN¡¡¡¡¡¡¡¡¡¡(SELECTTOP20id¡¡¡¡¡¡¡¡fromTestTable¡¡¡¡¡¡¡¡ORDERBYid))ORDERBYIDSELECTTOPÒ³´óС*fromTestTableWHERE(IDNOTIN¡¡¡¡¡¡¡¡¡¡(SELECTTOPÒ³´óС*Ò³Êýid¡¡¡¡¡¡¡¡from±í¡¡¡¡¡¡¡¡ORDERBYid))ORDERBYID
¡¡¡¡2.·Ö ......