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

SQL×Ó²éѯʵÀý

×Ó²éѯÊÇÔÚÒ»¸ö²éѯÄڵIJéѯ¡£×Ó²éѯµÄ½á¹û±»DBMSʹÓÃÀ´¾ö¶¨°üº¬Õâ¸ö×Ó²éѯµÄ¸ß¼¶²éѯµÄ½á¹û¡£ÔÚ×Ó²éѯµÄ×î¼òµ¥µÄÐÎʽÖУ¬×Ó²éѯ³ÊÏÖÔÚÁíÒ»ÌõSQLÓï¾äµÄWHERE»òHAVING×Ó¾ÖÄÚ¡£ 
    ÁгöÆäÏúÊÛÄ¿±ê³¬¹ý¸÷¸öÏúÊÛÈËÔ±¶¨¶î×ۺϵÄÏúÊ۵㡣
SELECT CITY
from OFFICES
WHERE TARGET > (SELECT SUM(QUOTA) 
                             from SALESREPS 
                             WHERE REP_OFFICES = OFFICE)
SQL×Ó²éѯһ°ã×÷ΪWHERE×Ó¾ä»òHAVING×Ó¾äµÄÒ»²¿·Ö³öÏÖ¡£ÔÚWHERE×Ó¾äÖУ¬ËüÃÇ°ïÖúÑ¡ÔñÔÚ²éѯ½á¹ûÖгÊÏֵĸ÷¸ö¼Ç¼¡£ÔÚHAVING×Ó¾äÖУ¬ËüÃÇ°æÖ÷Ñ¡ÔñÔÚ²éѯ½á¹ûÖгÊÏֵļǼ×é¡£
×Ó²éѯºÍʵ¼ÊµÄSELECTÓï¾äÖ®¼äµÄÇø±ð£º 
ÔÚ³£¼ûµÄÓ÷¨ÖУ¬×Ó²éѯ±ØÐëÉú³ÉÒ»¸öÊý¾Ý×Ö¶Î×÷ΪËüµÄ²éѯ½á¹û¡£ÕâÒâζ×ÅÒ»¸ö×Ó²éѯÔÚËüµÄSELECT×Ó¾äÖм¸ºõ×ÜÊÇÓÐÒ»¸öÑ¡ÔñÏî¡£
ORDER BY×Ӿ䲻ÄÜÔÚ×Ó²éѯÖÐÖ¸¶¨£¬×Ó²éѯ½á¹û±»ÖвéѯÔÚÄÚ²¿Ê¹Ó㬶ÔÓû§À´ËµÓÀÔ¶ÊDz»¿É¼ûµÄ£¬ËùÒÔ¶ÔËüÃǽøÐÐÅÅÐòûÓÐÒ»µãÒâÒå¡£
³ÊÏÖÔÚ×Ó²éѯÖеÄ×Ö¶ÎÃû¿ÉÄÜÒýÓÃÖ÷²éѯÖбíµÄ×ֶΡ£
ÔÚ´ó¶àÊýʵÏÖÖУ¬×Ö²éѯ²»ÄÜÊǼ¸¸ö²»Í¬µÄSELECTÓï¾äµÄUNION£¬ËüÖ»ÔÊÐíÒ»¸öSELECT¡£
WHEREÖеÄ×Ó²éѯ 
×Ó²éѯ×î³£ÓÃÔÚSQLÓï¾äµÄWHERE×Ó¾äÖС£
ÁгöÆ䶨¶îСÓÚÈ«¹«Ë¾ÏúÊÛÄ¿±êµÄ10%µÄÏúÊÛÈËÔ±¡£
SELECT NAME 
from SALESREPS
WHERE QUOTA < (.1 * (SELECT SUM(TARGET)) from OFFICES)
£¨×Ó²éѯÉú³ÉÓÃÀ´²âÊÔËÑË÷Ìõ¼þµÄÖµ¡££©
ÁгöÆ乫˾µÄÏúÊÛÄ¿±ê³¬¹ý¸÷¸öÏúÊÛÈËÔ±¶¨¶î×ܺ͵ÄÏúÊ۵㡣
SELECT CITY
from OFFICES
WHERE TARGET > (SELECT SUM(QUOTA) 
                              from S


Ïà¹ØÎĵµ£º

Access¡¢SQLServer¡¢Oracle³£¼ûSQLÓï¾äÓ¦ÓÃÇø±ð


Access¡¢SQLServer¡¢Oracle³£¼ûSQLÓï¾äÓ¦ÓÃÇø±ð
¹Ø¾¢ËÉ PMP
Èç¹ûÒª¼æÈÝAccess¡¢SQL Server¡¢OracleÈý¸öÊý¾Ý¿â°æ±¾£»ÎÒÃÇÔÚ±àдSQLÓï¾äµÄ¹ý³ÌÖУ¬¾¡Á¿Ê¹ÓÃһЩͨÓõÄÓï¾ä£¬µ«»¹ÊÇÓÐЩ·½ÃæÓÐЩÇø±ð±ÜÃâ²»ÁË£¬ÏÖ¼òµ¥×ܽáһϡ£
ÒÔÏÂA´ú±íAccess,S´ú±íSQL Server,O´ú±íOracle
1¡¢È¡µ±Ç°ÏµÍ³Ê±¼ä
A:Select Now()
S:Selec ......

PowerDesignerÉú³ÉsqlºÍ·´Ïò¹¤³ÌÉú³ÉERͼµÄÎÊÌâ

PowerDesignerÉú³ÉsqlºÍ·´Ïò¹¤³ÌÉú³ÉERͼµÄÎÊÌâ
Ò»¡¢PowerDesignerÉú³ÉsqlÎÊÌâ
Éú³ÉsqlµÄ·½·¨ÊÇ Database -->Generate Database (Ctrl + G ) µ«ÊÇÌáʾ
Could not load VBScript engine.
Check VBScript installation.
Generation aborted due to errors detected during the verification of the model.
¼ì²éÁ˺à ......

¸ü¸ÄSql*plusµÄÌáʾ·û

  Õý³£µÇ½sql*plusµÄ²½ÖèÈçÏ£º
sbdatabase*orcl-/home/oracle>sqlplus /nolog
SQL*Plus: Release 10.2.0.3.0 - Production on Sun May 9 19:50:24 2010
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
SQL> conn hmsimis/test@orcl
Connected.
SQL>
¿ÉÒÔ¿´µ½Ç°ÃæµÄÌáʾ·ûÊÇSQL£¬ÏÖÔÚÏëÐ ......

Asp.NetÖÐsql server 2000/2005 Á¬½Ó×Ö·û´®


http://zhanglei1286.blog.163.com/blog/static/1895797120091112113019600/
ÔÚºǫ́´úÂëÀ
SQL 2000:
static string StrConn = "server=.;uid=sa;pwd=sa;database=MyCUDS";
SQL2005:
con = new SqlConnection(@"Server=.\SQLExpress;Database=db_CMS;Persist Security Info=True;User ID=sa;Password=Masslong"); ......

½²½âMSSQLÊý¾Ý¿âÖÐSQLËø»úÖƺÍÊÂÎñ¸ôÀ뼶±ð

Ëø»úÖÆ
NOLOCKºÍREADPASTµÄÇø±ð¡£
1. ¿ªÆôÒ»¸öÊÂÎñÖ´ÐвåÈëÊý¾ÝµÄ²Ù×÷¡£
BEGIN TRAN t
INSERT INTO Customer
SELECT 'a','a'
2. Ö´ÐÐÒ»Ìõ²éѯÓï¾ä¡£
SELECT * from Customer WITH (NOLOCK)
½á¹ûÖÐÏÔʾ"a"ºÍ"a"¡£µ±1ÖÐÊÂÎñ»Ø¹öºó£¬ÄÇôa½«³ÉΪÔàÊý¾Ý¡£(×¢:1ÖеÄÊÂÎñδÌá½») ¡£NOLOCK±íÃ÷ûÓжÔÊý¾Ý±íÌí¼Ó¹²Ï ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ