SQLÃæÊÔÌâ
Insert Into Êý¾Ý±íÃû³Æ(×Ö¶ÎÃû³Æ1,×Ö¶ÎÃû³Æ2,...) values(×Ö¶ÎÖµ1,×Ö¶ÎÖµ2,...)
insert into user(username,password,age) values('ÀîÀÏËÄ','6666',45)
Update Êý¾Ý±íÃû³Æ Set ×Ö¶ÎÃû³Æ=×Ö¶ÎÖµ,×Ö¶ÎÃû³Æ=×Ö¶ÎÖµ,...[Where Ìõ¼þ]
Delete from Êý¾Ý±í
ÏÂÁвéѯ·µ»ØÔÚLONDON£¨Â׶أ©»òSEATTLE£¨Î÷ÑÅͼ£©µÄËùÓйÍÔ±£º
SELECT * from employees WHERE UPPER(city) IN ('LONDON'£¬'SEATTLE')
ÏÂÃæʾÀýÀûÓÃDATEDIFFº¯Êý£¬È·¶¨ÔÚ pubs Êý¾Ý¿âÖбêÌâ·¢²¼ÈÕÆں͵±Ç°ÈÕÆÚ¼äµÄÌìÊý¡£
SELECT DATEDIFF(day, OrderDate, getdate()) AS no_of_days from table1
·µ»Ø×Ö·û´®"wonderful"ÔÚ titles ±íµÄ notes ÁÐÖпªÊ¼µÄλÖá£
SELECT CHARINDEX('wonderful', notes)
ÒÔÏÂÊÇ·µ»ØµÄ½á¹û£º£¨µÚ47¸ö×Ö·ûλÖã©
ÏÔʾ¹¤×÷Õ¾µÄÃû³Æ£ºselect host_name() as [Client Computer Name]
ÏÂÀýÊǼìË÷ titles ±íÖаٷÖÖ®ÎåÊ®µÄÊé¡£Èç¹û titles ±íÖаüº¬ÁË 18 ÐУ¬Ôò½«¼ìË÷Ç° 9 ÐС£
SELECT TOP 50 PERCENT title from titles
×Ö¶ÎÃû³Æ [Not] Between Æðʼֵ and ÖÕÖ¹Öµ
ÁгöBOOK±íÖÐ30ÖÁ50ÔªµÄÊé
select * from book where price between 30 and 50
×Ö¶ÎÃû³Æ [Not] In(ÁгöÖµ1,ÁгöÖµ2,...)
´ÓBOOK±íÖÐÁгö¼Û¸ñΪ30,40,50,60µÄËùÓÐÊé
select * from book where price in(30,40,50,60)
×Ö¶ÎÃû³Æ [Not] Like "ͨÅä·û"
ÁгöBOOK±íÖгö°æÉ纬µçµÄËùÓмǼ
select * from book where publishing like '*µç*'
ÁгöBOOK±íÖгö°æÉçµÚÒ»¸ö×ÖÊǵçµÄËùÓмǼ
select * from book where publishing like 'µç*'
---
select Sum/Count/Avg/Max/Min(×Ö¶ÎÃû³Æ) [As ÐÂÃû³Æ] from Êý¾Ý±íÃû³Æ
sumÇóºÍ£º
Çó³ö×ܼ۸ñ×öΪºÏ¼Æ×Ö¶Î
select sum(price ) as ºÏ¼Æ from book
countͳ¼ÆÊýÁ¿£º
ͳ¼ÆBOOK±íÖÐÓжàÉÙÌõ¼Ç¼×öΪÊýÁ¿×Ö¶Î
select count(id) as ÊýÁ¿ from book
AVGƽ¾ù£º
Ëã³öBOOK±íÖÐËùÓÐÊéµÄƽ¾ù¼Û¸ñ
select avg(price) as ƽ¾ù¼Û¸ñ from book
MAX×î´ó£º
ÁгöBOOK±íÖÐ×î¹óµÄÊé
select max(price) as ×î¹óÊé from book
MIN×îС£º
select min(price) as ×î±ãÒËÊé from book
½»²æÁª½Ó: SELECT * from table1 CROSS JOIN table2
select x.[name], y.[name] from x left join y on x.[refid] = y.id
select y.[name], x.[name] from x right join y on x.[refid] = y.id
±íÁª½Ó²éѯ
SEL
Ïà¹ØÎĵµ£º
¸üУºÐµĶ«Î÷´Ó×îеĸüн«ÊǺìÉ«µÄ¡£
This list will grow as I find new tools.Õâ·ÝÃûµ¥½«³É³¤ÎªÎÒÕÒµ½ÐµĹ¤¾ß¡£ So if you know of some not on this list do post them in the comments.ËùÒÔ£¬Èç¹ûÄãÖªµÀһЩ²»ÔÚ´ËÃûµ¥ÖеÄÒâ¼ûºó×öËûÃÇ¡£
SQL Server Management Studio Add-in's SQL Server¹ÜÀí¹¤×÷ÊÒÍâ½ÓµÄ
......
ÎÊÌâ:
Äú¹¤×÷µÄ±¾»ú×°ÓÐVisual Studio 2005£¬¾ÖÓòÍøÖÐÓÐһ̨SQL Server 2005Êý¾Ý¿â·þÎñÆ÷£¬ÄãÏëͨ¹ý±¾»úÔ¶³Ìµ÷ÊÔSQL Server 2005·þÎñÆ÷ÉϵĴ洢¹ý³Ì¡£µ«ÊDz»ÖªµÀÈçºÎÅäÖûòÆôÓÃÔ¶³Ìµ÷ÊÔ£¿Ï£ÍûÕâƪÎÄÕ¶ÔÄúÓÐÓ᣶ÔÓÚÊý¾Ý¿âºÍVisual StudioÔÚͬһ»úÆ÷µÄ´æ´¢¹ý³Ìµ÷ÊÔ£¬Ô°×ÓÀïÒѾÓÐһƪÒë×÷˵µÄºÜºÃÁË£¬¿ ......
1½«sqlÖÐʹÓõÄһЩÌØÊâ·ûºÅ£¬Èç' -- /* ; %µÈÓÃReplace()¹ýÂË£»
2ÏÞÖÆÎı¾¿òÊäÈë×Ö·ûµÄ³¤¶È£»
3¼ì²éÓû§ÊäÈëµÄºÏ·¨ÐÔ£»¿Í»§¶ËÓë·þÎñÆ÷¶Ë¶¼ÒªÖ´ÐУ¬¿ÉÒÔʹÓÃÕýÔò¡£
4ʹÓôø²ÎÊýµÄSQLÓï¾äÐÎʽ¡£
ASP.NETÖÐÈçºÎ·À·¶SQL×¢Èëʽ¹¥»÷
Ò»¡¢Ê²Ã´ÊÇSQL×¢Èëʽ¹¥»÷£¿
¡¡¡¡ËùνSQL×¢Èëʽ¹¥»÷£¬¾ÍÊǹ¥»÷Õß°Ñ ......
½ñÌìÔÚÓÃJTDSÁ¬½ÓSQL Server ʱºò£¬Óöµ½¼¸¸öÎÊÌ⣬¼Ç¼ÈçÏ£º
error while performing database login with the jtds driver:
network error ioexception:connection refused: connect
È»ºó²é¿´¶Ë¿Ú£¬ÔÀ´ÊÇ1433¶Ë¿Úδ´ò¿ª£¬È»ºóÔÚSQL Server configuration ManagerϵÄTCP\IPÖÐÆôÓÃ1433¶Ë¿Ú£¬ÖØÆôSQL Server·þÎñ£¬netst ......
ÎÒÃÇÒª×öµ½²»µ«»áдSQL,»¹Òª×öµ½Ð´³öÐÔÄÜÓÅÁ¼µÄSQL,ÒÔÏÂΪ±ÊÕßѧϰ¡¢ÕªÂ¼¡¢²¢»ã×ܲ¿·Ö×ÊÁÏÓë´ó¼Ò·ÖÏí£¡
£¨1£© Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
ORACLE µÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦À ......