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

³£ÓÃsqlÏà¹Ø

1Ð޸Ļù±¾±í
 Ìí¼ÓÁÐ alter table tableName add<ÐÂÁÐÃû><Êý¾ÝÀàÐÍ>[ÍêÕûÐÔÔ¼Êø]
 É¾³ýÁÐ alter table tableName drop<ÐÂÁÐÃû><Êý¾ÝÀàÐÍ>[ÍêÕûÐÔÔ¼Êø]
2´´½¨
  ½¨±ícreate table tableName(
id primary key AUTO_INCREMENT(mysql);
id primary key identity(1,1)(sql server)
)
   ½¨Á¢Ë÷Òý
  create index OID_IDX on ±íÃû(number);
  create unique index oin_idx on ±íÃû(number);´´½¨Î¨Ò»Ë÷Òý
3 É¾³ý
   É¾³ýË÷Òý drop index <Ë÷ÒýÃû>
   ɾ³ý±í     drop table <±íÃû>
4 sql¹¦ÄÜ
   Êý¾Ý²éѯ select
   Êý¾Ý¶¨Òå create drop alter
   Êý¾Ý²Ù¿Ø insert update delete
   Êý¾Ý¿ØÖÆ grant(ÊÚȨ) revoke(ÊÕ»ØȨÏÞ)
(1) Êý¾Ý²éѯ
     select * from tableName where <Ìõ¼þ±í´ïʽ> group by<ÁÐÃû>[having<Ìõ¼þ>]  order by<ÁÐÃû>[ASC DESC] 
     select distinct Sno from sc ²éѯÊý¾ÝÈ¥µôÖظ´ÐÐ
     ³£¼ûµÄ²éѯÌõ¼þ
     ±È½Ï = ,>,<,<=,<=,!=,<>,!<,!>,
     È·¶¨·¶Î§ between and |not between and
     È·¶¨¼¯ºÏ in ,not in
     ×Ö·ûÆ¥Åä like ,not like like '<Æ¥Åä·û>' Æ¥Åä·û¿ÉÒÔ°üº¬Í¨Åä·û%ºÍ_
     ¿ÕÖµ       is null ,is not null
     ¶àÖØÌõ¼þ(Âß¼­ÔËËã) and,or,not
     select  a.name,a.mialbox from a where EXISTS(select b.name from b where a.name=b.name)
     Áª½Ó²éѯjoin
     select a.number,a,name,b.age,b.sort from a join b on a.number=b.number
     inner join ÄÚÁª½Ó ÓÃÓÚ·µ»ØÁ½¸ö±íÖÐÒª²éѯµÄÁÐÊý¾Ý left join right join
     ³£¼ûÔËËãÒÔ¼°¾Û¼¯º¯Êý
         ABS(x)·µ»Ø¾ø¶ÔÖµ
   &


Ïà¹ØÎĵµ£º

sql server 2005 imageÊý¾ÝÀàÐ͵ÄʹÓÃ

       ×î½ü×öÒ»¸öÏîÄ¿µÄʱºòÐèÒªÍùÊý¾Ý¿âÄÚ²åÈëͼƬ£¬ÉÏÍø²éÁËһϣ¬Ö÷ÒªÓÐÁ½ÖÖ·½·¨£¬µÚÒ»¾ÍÊÇÔÚÊý¾Ý¿âÖд洢ͼƬµÄ·¾¶£¬È»ºóÔÚ³ÌÐòÖиù¾Ý¶ÁÈ¡µÄ·¾¶¶ÁȡͼƬ£»ÕâÖÖ·½·¨¼òµ¥¡¢ÈÝÒ×ʹÓ㬵«ÊÇÔÚͼƬ¹ý¶àʱ²»ºÃ¹ÜÀí¡£
      µÚ¶þÖÖ¾ÍÊǽ«Í¼Æ¬×ª»»³É¶þ½øÖÆ´æ´¢ÓÚÊý ......

sql convertÈÕÆÚʱ¼ä¸ñʽ

--²éѯÏÖÔÚÈÕÆÚ£¬Ö»ÒªÄêÔÂÈÕ
 select convert(varchar(10),getDate(),120)
--²éѯÏÖÔÚÈÕÆÚ£¬Ö»ÒªÊ±·ÖÃë
select convert(varchar(8),getDate(),8)
Convertº¯ÊýµÄһЩ˵Ã÷£¬ÒÔÏÂ×ÊÁÏÀ´Ô´ÓÚÍøÂç
²»´øÊÀ¼ÍÊýλ (yy)
´øÊÀ¼ÍÊýλ (yyyy)

±ê×¼

ÊäÈë ......

SQLÖбí±äÁ¿ºÍÁÙʱ±íµÄÓÅȱµã

http://www.cnblogs.com/Mainz/archive/2008/12/20/1358897.html
ʲôÇé¿öÏÂʹÓñí±äÁ¿£¿Ê²Ã´Çé¿öÏÂʹÓÃÁÙʱ±í£¿
±í±äÁ¿£º
DECLARE @tb  table(id   int   identity(1,1), name   varchar(100))
INSERT @tb
SELECT id, name
from mytable
WHERE name like ‘zhang%&rsquo ......

35Ìõ»ù±¾SQLÓï¾ä

 1¡¢²éÕÒÔ±¹¤µÄ±àºÅ¡¢ÐÕÃû¡¢²¿ÃźͳöÉúÈÕÆÚ£¬Èç¹û³öÉúÈÕÆÚΪ¿ÕÖµ£¬ÏÔʾÈÕÆÚ²»Ïê,²¢°´²¿ÃÅÅÅÐòÊä³ö,ÈÕÆÚ¸ñʽΪyyyy-mm-dd¡£
select
emp_no,emp_name,dept,isnull(convert(char(10),birthday,120),'ÈÕÆÚ²»Ïê') birthday
from employee
order by dept
 
¡¡¡¡
2¡¢²éÕÒÓëÓ÷×ÔÇ¿ÔÚͬһ¸öµ¥Î»µÄÔ±¹¤ÐÕÃû¡¢ÐÔ±ð¡ ......

SQL ServerÈÕÖ¾Çå¿Õ·½·¨

תÔØ£ºhttp://blog.csdn.net/cnming/archive/2009/03/11/3979290.aspx
ÔÚ²éѯ·ÖÎöÆ÷ÖÐ˳ÐòÖ´ÐÐÒÔÏÂÈý²½£¬ÆäÖР  databasename   ΪÄãµÄÊý¾Ý¿âÎļþÃû
1.Çå¿ÕÈÕÖ¾£ºDUMP   TRANSACTION   databasename   WITH   NO_LOG  
2.½Ø¶ÏÊÂÎñÈÕÖ¾£ºBACKUP ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ