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

SQL²éѯÓÅ»¯,×¢ÒâwhereÌõ¼þµÄ˳Ðò

×÷Õß:ÂÞ´ú¾ù ldj_work#126.com   תÔØÇë±£³ÖÍêÕûÐÔ
1.²âÊÔ±í
    employee
    ¹ÍÔ±id     ²¿ÃÅid      н½ð
    emp_id    dept_id    salary
      01            01           1050
      02             01           2000
   ok,ÎÒÃÇÒª²éÕÒ²¿ÃÅ01ÏÂ,н½ð¸ßÓÚ1000µÄ¹ÍÔ±
2.Ô­Ôò¼°Á½¸öSQLµÄ¶Ô±È
Ô­Ôò,¶àÊýÊý¾Ý¿â¶¼ÊÇ´Ó ×óµ½ÓÒµÄ˳Ðò´¦ÀíÌõ¼þ,°ÑÄܹýÂ˸ü¶àÊý¾ÝµÄÌõ¼þ·ÅÔÚÇ°Ãæ,¹ýÂËÉÙµÄÌõ¼þ·ÅºóÃæ
SQL1: select * from employee
            where salary >1000     --Ìõ¼þ1,¹ýÂ˵ÄÊý¾Ý½ÏÉÙ
                 and   dept_id='01'    --Ìõ¼þ2,¹ýÂ˵ÄÊý¾Ý±ÈÌõ¼þ1¶à
ÉÏÃæµÄSQL¾Í²»·ûºÏÎÒÃǵÄÔ­ÔòÁË,Ó¦¸Ã°Ñ¹ýÂËÊý¾Ý¸ü¶àµÄÌõ¼þ·ÅÔÚÇ°Ãæ,Òò´Ë¸ÄΪÏÂÃæÕâÑù¸üºÃ
             select * from employee
              where   dept_id='01'     --¹ýÂ˸ü¶àÊý¾ÝµÄÌõ¼þ·ÅÔÚÇ°Ãæ
                  and   salary > 1000


Ïà¹ØÎĵµ£º

SQL RIGHT JOIN ¹Ø¼ü×Ö

SQL RIGHT JOIN ¹Ø¼ü×Ö
SQL RIGHT JOIN ¹Ø¼ü×Ö
RIGHT JOIN ¹Ø¼ü×Ö»áÓÒ±í (table_name2) ÄÇÀï·µ»ØËùÓеÄÐУ¬¼´Ê¹ÔÚ×ó±í (table_name1) ÖÐûÓÐÆ¥ÅäµÄÐС£
RIGHT JOIN ¹Ø¼ü×ÖÓï·¨
SELECT column_name(s)
from table_name1
RIGHT JOIN table_name2
ON table_name1.column_name=table_name2.column_name
×¢ÊÍ£ºÔÚijЩÊý ......

EclipseÖÐHibernateÅäÖÃSQL Server 2000µÄÎÊÌâ

 ×î½üÔÚѧϰHibernate£¬Êý¾Ý¿âÊÇSQL 2000£¬myEclipse7.5£¬¸ù¾ÝÀý×ÓÅäÖúÃHibernateÖ®ºóÔËÐУ¬³öÏÖ£º
com.microsoft.jdbc.base.BaseDatabaseMetaData.supportsGetGeneratedKeys() Õâ¸ö´íÎ󣬵¹ÌÚ°ëÌìÖ®ºó·¢ÏÖÊÇmsbase.jar¡¢mssqlserver.jar¡¢msutil.jarÕâÈý¸ö°üµÄÎÊÌ⣬SQL 2000µÄÊý¾Ý¿âÇý¶¯ÐèÒª×îеİ汾£¬ÕâÈý¸ö°ü¸ ......

sql ²éѯÂýµÄ48¸öÔ­Òò·ÖÎö

1¡¢Ã»ÓÐË÷Òý»òÕßûÓÐÓõ½Ë÷Òý(ÕâÊDzéѯÂý×î³£¼ûµÄÎÊÌ⣬ÊdzÌÐòÉè¼ÆµÄȱÏÝ)
¡¡¡¡2¡¢I/OÍÌÍÂÁ¿Ð¡£¬ÐγÉÁËÆ¿¾±Ð§Ó¦¡£
¡¡¡¡3¡¢Ã»Óд´½¨¼ÆËãÁе¼Ö²éѯ²»ÓÅ»¯¡£
¡¡¡¡4¡¢ÄÚ´æ²»×ã
¡¡¡¡5¡¢ÍøÂçËÙ¶ÈÂý
¡¡¡¡6¡¢²éѯ³öµÄÊý¾ÝÁ¿¹ý´ó(¿ÉÒÔ²ÉÓöà´Î²éѯ£¬ÆäËûµÄ·½·¨½µµÍÊý¾ÝÁ¿)
¡¡¡¡7¡¢Ëø»òÕßËÀËø(ÕâÒ²ÊDzéѯÂý×î³£¼ûµÄÎÊÌ⣠......

MS SQL Server²éѯÓÅ»¯·½·¨

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

Sql Server2005¶Ôt sqlµÄÔöÇ¿Ö®Cross Apply

Cross Applyʹ±í¿ÉÒԺͱíÖµº¯Êý½á¹û½øÐÐjoin£¬ÔÚÏÂÃæµÄʾÀýÖн¨ÁËÁ½¸ö±íºÍÒ»¸ö±íÖµº¯Êý£¬T_bµÄÁÐa_idsÖлá´æ·Åa±íµÄidÓÃ,·Ö¸îµÄ×Ö·û´®Á¬½Ó£»ÎÒÃÇͨ¹ýcross applyʹT_a£¬T_b±íͨ¹ýsplitIDs inner join Á¬½Ó¡£Ç뿴ʾÀý£ºGO
if object_id('T_a','U') is not null
drop table T_a
GO
CREATE TABLE T_a(    ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ