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

¹ØÓÚSQL ServerµÄÓÅ»¯

ÈçºÎÓÅ»¯SQL Server
1¡¢  ÓóÌÐòÖУ¬±£Ö¤ÔÚʵÏÖ¹¦ÄܵĻù´¡ÉÏ£¬¾¡Á¿¼õÉÙ¶ÔÊý¾Ý¿âµÄ·ÃÎÊ´ÎÊý£»Í¨¹ýËÑË÷²ÎÊý£¬¾¡Á¿¼õÉÙ¶Ô±íµÄ·ÃÎÊÐÐÊý,×îС»¯½á¹û¼¯£¬´Ó¶ø¼õÇáÍøÂ縺µ££»Äܹ»·Ö¿ªµÄ ²Ù×÷¾¡Á¿·Ö¿ª´¦Àí£¬Ìá¸ßÿ´ÎµÄÏìÓ¦Ëٶȣ»ÔÚÊý¾Ý´°¿ÚʹÓÃSQLʱ£¬¾¡Á¿°ÑʹÓõÄË÷Òý·ÅÔÚÑ¡ÔñµÄÊ×ÁУ»Ëã·¨µÄ½á¹¹¾¡Á¿¼òµ¥£»ÔÚ²éѯʱ£¬²»Òª¹ý¶àµØʹÓÃͨÅä·û ÈçSELECT * from T1Óï¾ä£¬ÒªÓõ½¼¸ÁоÍÑ¡Ôñ¼¸ÁÐÈ磺SELECT COL1,COL2 from T1£»ÔÚ¿ÉÄܵÄÇé¿öϾ¡Á¿ÏÞÖƾ¡Á¿½á¹û¼¯ÐÐÊýÈ磺SELECT TOP 300 COL1,COL2,COL3 from T1,ÒòΪijЩÇé¿öÏÂÓû§ÊDz»ÐèÒªÄÇô¶àµÄÊý¾ÝµÄ¡£²»ÒªÔÚÓ¦ÓÃÖÐʹÓÃÊý¾Ý¿âÓα꣬ÓαêÊǷdz£ÓÐÓõŤ¾ß£¬µ«±ÈʹÓó£¹æµÄ¡¢ÃæÏò¼¯µÄSQLÓï¾äÐèÒª¸ü´óµÄ¿ª Ïú£»°´ÕÕÌض¨Ë³ÐòÌáÈ¡Êý¾ÝµÄ²éÕÒ¡£
2¡¢   ±ÜÃâʹÓò»¼æÈݵÄÊý¾ÝÀàÐÍ¡£ÀýÈçfloatºÍint¡¢charºÍvarchar¡¢binaryºÍvarbinaryÊDz»¼æÈݵġ£Êý¾ÝÀàÐ͵IJ»¼æÈÝ¿ÉÄÜʹÓÅ»¯Æ÷ÎÞ·¨Ö´ÐÐһЩ±¾À´¿ÉÒÔ½øÐеÄÓÅ»¯²Ù×÷¡£ÀýÈç:
SELECT name from employee WHERE salary £¾ 60000
ÔÚÕâÌõÓï¾äÖÐ,Èçsalary×Ö¶ÎÊÇmoneyÐ͵Ä,ÔòÓÅ»¯Æ÷ºÜÄѶÔÆä½øÐÐÓÅ»¯,ÒòΪ60000ÊǸöÕûÐÍÊý¡£ÎÒÃÇÓ¦µ±ÔÚ±à³Ìʱ½«ÕûÐÍת»¯³ÉΪǮ±ÒÐÍ,¶ø²»ÒªµÈµ½ÔËÐÐʱת»¯¡£
3¡¢   ¾¡Á¿±ÜÃâÔÚWHERE×Ó¾äÖжÔ×ֶνøÐк¯Êý»ò±í´ïʽ²Ù×÷£¬Õ⽫µ¼ÖÂÒýÇæ·ÅÆúʹÓÃË÷Òý¶ø½øÐÐÈ«±íɨÃè¡£È磺
SELECT * from T1 WHERE F1/2=100
Ó¦¸ÄΪ:
SELECT * from T1 WHERE F1=100*2
SELECT * from RECORD WHERE SUBSTRING(CARD_NO,1,4)=’5378’
Ó¦¸ÄΪ:
SELECT * from RECORD WHERE CARD_NO LIKE ‘5378%’
SELECT member_number, first_name, last_name  from members
WHERE DATEDIFF(yy,datofbirth,GETDATE()) > 21
Ó¦¸ÄΪ:
SELECT member_number, first_name, last_name  from members
WHERE dateofbirth < DATEADD(yy,-21,GETDATE())
¼´£ºÈκζÔÁеIJÙ×÷¶¼½«µ¼Ö±íɨÃ裬Ëü°üÀ¨Êý¾Ý¿âº¯Êý¡¢¼ÆËã±í´ïʽµÈµÈ£¬²éѯʱҪ¾¡¿ÉÄܽ«²Ù×÷ÒÆÖÁµÈºÅÓұߡ£
4¡¢   ±ÜÃâʹÓÃ!=»ò£¼£¾¡¢IS NULL»òIS NOT NULL¡¢IN £¬NOT INµÈÕâÑùµÄ²Ù×÷·û,ÒòΪÕâ»áʹϵͳÎÞ·¨Ê¹ÓÃË÷Òý,¶øÖ»ÄÜÖ±½ÓËÑË÷±íÖеÄÊý¾Ý¡£ÀýÈç:
SELECT id from employee WHERE id != 'B%'
ÓÅ»¯Æ÷½«ÎÞ·¨Í¨¹ýË÷ÒýÀ´È·¶¨½«ÒªÃüÖеÄÐÐÊý,Òò´ËÐèÒªËÑË÷¸Ã±íµÄËùÓÐÐС£
 
5¡¢   ¾¡Á¿Ê¹ÓÃÊý×ÖÐÍ×ֶΣ¬Ò»²¿·Ö¿ª·¢ÈËÔ±ºÍÊý¾Ý¿â¹ÜÀíÈË


Ïà¹ØÎĵµ£º

50ÖÖ·½·¨ÇÉÃîÓÅ»¯ÄãµÄSQL ServerÊý¾Ý¿â

Ô­ÎÄÁ´½Ó:http://blog.btidea.com/article.asp?id=440
²éѯËÙ¶ÈÂýµÄÔ­ÒòºÜ¶à£¬³£¼ûÈçϼ¸ÖÖ£º
¡¡¡¡
¡¡¡¡1¡¢Ã»ÓÐË÷Òý»òÕßûÓÐÓõ½Ë÷Òý(ÕâÊDzéѯÂý×î³£¼ûµÄÎÊÌ⣬ÊdzÌÐòÉè¼ÆµÄȱÏÝ)
¡¡¡¡
¡¡¡¡2¡¢I/OÍÌÍÂÁ¿Ð¡£¬ÐγÉÁËÆ¿¾±Ð§Ó¦¡£
¡¡¡¡
¡¡¡¡3¡¢Ã»Óд´½¨¼ÆËãÁе¼Ö²éѯ²»ÓÅ»¯¡£
¡¡¡¡
¡¡¡¡4¡¢ÄÚ´æ²»×ã
¡¡¡¡
¡¡¡¡5¡¢ÍøÂç ......

asp/asp.netÁ¬½Ósql anywhereÊý¾Ý¿â


<%
set conn= server.createobject("ADODB.connection")
conn.open "driver={sybase driver 10};"
"srvr=SYBASE;"
"UID=sa;"
"pwd=sybase;"
sql="select no from tab_st ......

SQL ÓαêÔ­ÀíºÍʹÓ÷½·¨

 Êý¾Ý¿â¿ª·¢¹ý³ÌÖУ¬µ±Äã¼ìË÷µÄÊý¾ÝÖ»ÊÇÒ»Ìõ¼Ç¼ʱ£¬ÄãËù±àдµÄÊÂÎñÓï¾ä´úÂëÍùÍùʹÓÃSELECT INSERT Óï¾ä¡£µ«ÊÇÎÒÃdz£³£»áÓöµ½ÕâÑùÇé¿ö£¬¼´´Óijһ½á¹û¼¯ÖÐÖðÒ»µØ¶ÁÈ¡Ò»Ìõ¼Ç¼¡£ÄÇôÈçºÎ½â¾öÕâÖÖÎÊÌâÄØ£¿ÓαêΪÎÒÃÇÌṩÁËÒ»ÖÖ¼«ÎªÓÅÐãµÄ½â¾ö·½°¸¡£
      1.1 ÓαêºÍÓαêµÄÓŵã
  & ......

ͼÎÄÏê½âÈçºÎÓÃPowerDesignerÉè¼ÆSQL Server

¹¤¾ß£º
Sybase PowerDesigner 12.5
Microsoft SQL Server 2005
µÚÒ»²½£º¸ÅÒªÉè¼Æ
´ò¿ªPowerDesignerÈí¼þ£¬Éè¼Æ“¸ÅÄîÊý¾ÝÄ£ÐÍ”(Conceptual Data Model)£º
 
ͼ1
Éè¼Æ±í½á¹¹£º
 
ͼ2
ÔÚÉè¼ÆÊôÐÔ(×Ö¶Î)µÄʱºò£¬Èý¸ö×Öĸ(M¡¢P¡¢D)·Ö±ð±íʾ£º
M£ºÊÇ·ñΪ¿Õ;(√±íʾ²»ÔÊÐíΪ¿Õ)
P£ºÊÇ·ñ뻅 ......

ms sql server ´´½¨Óû§


SQL code
´´½¨½ÇÉ«£¬Óû§£¬È¨ÏÞ
/*--ʾÀý˵Ã÷
ʾÀýÔÚÊý¾Ý¿âpubsÖд´½¨Ò»¸öÓµÓбíjobsµÄËùÓÐȨÏÞ¡¢ÓµÓбítitlesµÄSELECTȨÏ޵ĽÇÉ«r_test
Ëæºó´´½¨ÁËÒ»¸öµÇ¼l_test£¬È»ºóÔÚÊý¾Ý¿âpubsÖÐΪµÇ¼l_test´´½¨ÁËÓû§ÕË»§u_test
ͬʱ½«Óû§ÕË»§u_testÌí¼Óµ½½ÇÉ«r_testÖУ¬Ê¹Æäͨ¹ýȨÏ޼̳лñÈ¡ÁËÓë½ÇÉ«r_t ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ