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

sql¿ìËÙÈëÃÅ

 
SQLÓïÑÔ¿ìËÙÈëÃÅ
ä½ Ïª ɳ
Àî璟
ÊÖ¾íÕæÖéÉÏÓñ¹³,ÒÀÇ°´ººÞËøÖØÂ¥, ·çÀïÂ仨˭ÊÇÖ÷, ˼ÓÆÓÆ
ÇàÄñ²»´«ÔÆÍâÐÅ,¶¡Ïã¿Õ½áÓêÖгî, »ØÊ×Â̲¨Èý³þĺ, ½ÓÌìÁ÷
SQLÓïÑÔ¿ìËÙÈëÃÅ
SQLÊÇÓ¢ÎÄStructured Query LanguageµÄËõд£¬Òâ˼Ϊ½á¹¹»¯²éѯÓïÑÔ¡£SQLÓïÑÔµÄÖ÷Òª¹¦ÄܾÍÊÇͬ¸÷ÖÖÊý¾Ý¿â½¨Á¢ÁªÏµ£¬½øÐйµÍ¨¡£°´ÕÕANSI£¨ÃÀ¹ú¹ú¼Ò±ê׼Э»á£©µÄ¹æ¶¨£¬SQL±»×÷Ϊ¹ØϵÐÍÊý¾Ý¿â¹ÜÀíϵ ͳµÄ±ê×¼ÓïÑÔ¡£SQLÓï¾ä¿ÉÒÔÓÃÀ´Ö´Ðи÷ÖÖ¸÷ÑùµÄ²Ù×÷£¬ÀýÈç¸üÐÂÊý¾Ý¿âÖеÄÊý¾Ý£¬´ÓÊý¾Ý¿âÖÐÌáÈ¡Êý¾ÝµÈ¡£Ä¿Ç°£¬¾ø´ó¶àÊýÁ÷ÐеĹØϵÐÍÊý¾Ý¿â¹ÜÀíϵͳ£¬Èç Oracle, Sybase, Microsoft SQL Server, AccessµÈ¶¼²ÉÓÃÁËSQLÓïÑÔ±ê×¼¡£ËäÈ»ºÜ¶àÊý¾Ý¿â¶¼¶ÔSQLÓï¾ä½øÐÐÁËÔÙ¿ª·¢ºÍÀ©Õ¹£¬µ«ÊÇ°üÀ¨Select, Insert, Update, Delete, Create, ÒÔ¼°DropÔÚÄڵıê×¼µÄSQLÃüÁîÈÔÈ»¿ÉÒÔ±»ÓÃÀ´Íê³É¼¸ºõËùÓеÄÊý¾Ý¿â²Ù×÷¡£ÏÂÃ棬ÎÒÃǾÍÀ´Ïêϸ½éÉÜÒ»ÏÂSQLÓïÑԵĻù±¾ÖªÊ¶¡£
Êý¾Ý¿â±í¸ñ
Ò»¸öµäÐ͵ĹØϵÐÍÊý¾Ý¿âͨ³£ÓÉÒ»¸ö»ò¶à¸ö±»³Æ×÷±í¸ñµÄ¶ÔÏó×é³É¡£Êý¾Ý¿âÖеÄËùÓÐÊý¾Ý»òÐÅÏ¢¶¼±»±£´æÔÚÕâЩÊý¾Ý¿â±í¸ñÖС£Êý¾Ý¿âÖеÄÿһ¸ö±í¸ñ¶¼¾ßÓÐ×Ô ¼ºÎ¨Ò»µÄ±í¸ñÃû³Æ£¬¶¼ÊÇÓÉÐкÍÁÐ×é³É£¬ÆäÖÐÿһÁаüÀ¨Á˸ÃÁÐÃû³Æ£¬Êý¾ÝÀàÐÍ£¬ÒÔ¼°ÁеÄÆäËüÊôÐÔµÈÐÅÏ¢£¬¶øÐÐÔò¾ßÌå°üº¬Ä³Ò»ÁеļǼ»òÊý¾Ý¡£ÒÔÏ£¬ÊÇÒ»¸öÃû ΪÌìÆøµÄÊý¾Ý¿â±í¸ñµÄʵÀý¡£
³ÇÊÐ ×î¸ßÆøΠ×îµÍÆøÎÂ
±±¾© 10 5
ÉϺ£ 15 8
Ìì½ò 8 2
ÖØÇì 20 13
¸Ã±í¸ñÖГ³ÇÊД£¬ “×î¸ßÆøΔºÍ“×îµÍÆøΔ¾ÍÊÇÈý¸ö²»Í¬µÄÁУ¬¶ø±í¸ñÖеÄÿһÐÐÔò°üº¬Á˾ßÌåµÄ±í¸ñÊý¾Ý¡£
Êý¾Ý²éѯ
ÔÚÖÚ¶àµÄSQLÃüÁîÖУ¬selectÓï¾äÓ¦¸ÃËãÊÇʹÓÃ×îƵ·±µÄ¡£SelectÓï¾äÖ÷Òª±»ÓÃÀ´¶ÔÊý¾Ý¿â½øÐвéѯ²¢·µ»Ø·ûºÏÓû§²éѯ±ê×¼µÄ½á¹ûÊý¾Ý¡£SelectÓï¾äµÄÓï·¨¸ñʽÈçÏ£º
select column1 [, column2,etc] from tablename
[where condition];
£¨[] ±íʾ¿ÉÑ¡Ï
selectÓï¾äÖÐλÓÚselect¹Ø¼ü´ÊÖ®ºóµÄÁÐÃûÓÃÀ´¾ö¶¨ÄÇЩÁн«×÷Ϊ²éѯ½á¹û·µ»Ø¡£Óû§¿ÉÒÔ°´ÕÕ×Ô¼ºµÄÐèҪѡÔñÈÎÒâÁУ¬»¹¿ÉÒÔʹÓÃͨÅä·û“*”À´É趨·µ»Ø±í¸ñÖеÄËùÓÐÁС£
selectÓï¾äÖÐλÓÚfrom¹Ø¼ü´ÊÖ®ºóµÄ±í¸ñÃû³ÆÓÃÀ´¾ö¶¨½«Òª½øÐвéѯ²Ù×÷µÄÄ¿±ê±í¸ñ¡£
SelectÓï¾äÖеÄwhere¿ÉÑ¡´Ó¾äÓÃÀ´¹æ¶¨ÄÄЩÊý¾ÝÖµ»òÄÄЩÐн«±»×÷Ϊ²éѯ½á¹û·µ»Ø»òÏÔʾ¡£
ÔÚwhereÌõ¼þ´Ó¾äÖпÉÒÔʹÓÃÒÔÏÂһЩÔËËã·ûÀ´É趨²éѯ±ê×¼£º
= µÈÓÚ
> ´óÓÚ
< СÓÚ
>= ´óÓÚµÈÓÚ
&l


Ïà¹ØÎĵµ£º

VistaÏÂSQL SERVER 2005 ¸½¼ÓÊý¾Ý¿â

1.´ò¿ªSQL Server Management Studio ExpressÒÔ“WindowsÉí·ÝÈÏÖ¤”µÄ·½Ê½µÇ¼¡£Èçͼ1£º
ͼ1£º
 
2.ÔÚSQL Server Management Studio ExpressÖеē¶ÔÏó×ÊÔ´¹ÜÀíÆ÷”--“Êý¾Ý¿â”ÉÏÓÒ¼ü--“¸½¼Ó”¡£Èçͼ2£º
ͼ2£º
 
3.ÔÚµ¯³öÀ´µÄ“¸½¼ÓÊý¾Ý¿â”´°¿ÚÖе¥» ......

SQLÁ÷Ë®ºÅÉú³ÉÓï¾ä

table
     
        Num        createDate
---------------------------------
      (¿Õ)          20090901
      (¿Õ)          20090901
      ......

ms sql ¸üбíAÖÐijÁÐΪ±íBÖеÄÖµ


ms sql ¸üбíAÖÐijÁÐΪ±íBÖеÄÖµ
select *
from dbo.NT_areapin
go
select *
from dbo.NT_dict_area
update NT_areapin
set AllNamePin='PengShui'
from NT_areapin
where AreaId='486'
go
update NT_dict_area
set BriefNamePin = NT_areapin.BriefNamePin,AllNamePin = NT_areapin.AllNamePin
from N ......

IISÓëSQL·þÎñÆ÷°²È«¼Ó¹ÌÏê½â(ת)

 
IIS Web·þÎñÆ÷°²È«¼Ó¹Ì²½Ö裺
²½Öè¡¡°²×°ºÍÅäÖà Windows Server 2003¡£
×¢Ò⣺
1.½«\System32\cmd.exeתÒƵ½ÆäËûĿ¼»ò¸üÃû£»
2.ϵͳÕʺž¡Á¿ÉÙ£¬¸ü¸ÄĬÈÏÕÊ»§Ãû£¨ÈçAdministrator£©ºÍÃèÊö£¬ÃÜÂ뾡Á¿¸´ÔÓ£»
3.¾Ü¾øͨ¹ýÍøÂç·ÃÎʸüÆËã»ú£¨ÄäÃûµÇ¼£»ÄÚÖùÜÀíÔ±ÕÊ»§£»Support_388945a0£»Guest£»ËùÓзDzÙ×÷ϵͳ·þ ......

sql²éѯ±íÖÐ×ֶβ»Öظ´

·½·¨Ò»£º
 select distinct name from tablename
·½·¨¶þ£º
select min(fid),name,sex from tablename group by name
×ܼƣº
select distinct name from tablename ´ò¿ªÖظ´¼Ç¼µÄµ¥¸ö×Ö¶Î
select * from tablename where fid in(Select min(fid) from tablename group by name)´ò¿ªÖظ´¼Ç¼µÄËùÓÐ×Ö¶ÎÖµ
select ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ