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

Ìá¸ßSQLÖ´ÐÐЧÂʵļ¸µã½¨Òé

Ìá¸ßSQLÖ´ÐÐЧÂʵļ¸µã½¨Òé:
¡¡¡¡¡ô¾¡Á¿²»ÒªÔÚwhereÖаüº¬×Ó²éѯ;
¡¡¡¡¹ØÓÚʱ¼äµÄ²éѯ£¬¾¡Á¿²»ÒªÐ´³É£ºwhere to_char(dif_date,'yyyy-mm-dd')=to_char('2007-07-01','yyyy-mm-dd');
¡¡¡¡¡ôÔÚ¹ýÂËÌõ¼þÖУ¬¿ÉÒÔ¹ýÂ˵ô×î´óÊýÁ¿¼Ç¼µÄÌõ¼þ±ØÐë·ÅÔÚwhere×Ó¾äµÄĩβ;
¡¡¡¡from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í£¬driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏ£¬Äã±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í¡£Èç¹ûÓÐÈý¸öÒÔÉϵÄÁ¬½Ó²éѯ£¬ÄǾÍÐèҪѡÔñ½»²æ±í(intersection table)×÷Ϊ»ù´¡±í£¬½»²æ±íÊÇÖ¸ÄǸö±»ÆäËû±íËùÒýÓõıí;
¡¡¡¡¡ô²ÉÓð󶨱äÁ¿
¡¡¡¡¡ôÔÚWHEREÖо¡Á¿²»ÒªÊ¹ÓÃOR
¡¡¡¡¡ôÓÃEXISTSÌæ´úIN¡¢ÓÃNOT EXISTSÌæ´úNOT IN;
¡¡¡¡¡ô±ÜÃâÔÚË÷ÒýÁÐÉÏʹÓüÆË㣺WHERE SAL*12>25000;
¡¡¡¡¡ôÓÃINÀ´Ìæ´úOR£º WHERE LOC_ID=10 OR LOC_ID=15 OR LOC_ID=20
¡¡¡¡¡ô±ÜÃâÔÚË÷ÒýÁÐÉÏʹÓÃIS NULLºÍIS NOT NULL;
¡¡¡¡¡ô×ÜÊÇʹÓÃË÷ÒýµÄµÚÒ»¸öÁÐ;
¡¡¡¡¡ôÓÃUNION-ALLÌæ´úUNION;
¡¡¡¡¡ô±ÜÃâ¸Ä±äË÷ÒýÁеÄÀàÐÍ£ºSELECT...from EMP WHERE EMPNO='123'£¬ÓÉÓÚÒþʽÊý¾ÝÀàÐÍת»»£¬to_char(EMPNO)='123'£¬Òò´Ë£¬½«²»²ÉÓÃË÷Òý£¬Ò»°ãÔÚ²ÉÓÃ×Ö·û´®Æ´´Õ¶¯Ì¬SQLÓï¾ä³öÏÖ;
¡¡¡¡¡ô'!=' ½«²»Ê¹ÓÃË÷Òý;
¡¡¡¡¡ôÓÅ»¯GROUP BY;
¡¡¡¡¡ô±ÜÃâ´øÓÐLIKE²ÎÊýµÄͨÅä·û£¬LIKE '4YE%'ʹÓÃË÷Òý£¬µ«LIKE '%YE'²»Ê¹ÓÃË÷Òý
¡¡¡¡¡ô±ÜÃâʹÓÃÀ§ÄѵÄÕý¹æ±í´ïʽ£¬ÀýÈçselect * from customer where zipcode like "98___"£¬¼´±ãÔÚzipcodeÉϽ¨Á¢ÁËË÷Òý£¬ÔÚÕâÖÖÇé¿öÏÂÒ²»¹ÊDzÉÓÃ˳ÐòɨÃèµÄ·½Ê½¡£Èç¹û°ÑÓï¾ä¸Ä³Éselect * from customer where zipcode>"98000"£¬ÔÚÖ´Ðвéѯʱ¾Í»áÀûÓÃË÷ÒýÀ´²éѯ£¬ÏÔÈ»»á´ó´óÌá¸ßËÙ¶È;
¡¡¡¡¡ô¾¡Á¿Ã÷È·µÄÍê³ÉSQLÓï¾ä£¬¾¡Á¿ÉÙÈÃÊý¾Ý¿â¹¤×÷¡£±ÈÈçдSELECTÓï¾äʱ£¬ÐèÒª°Ñ²éѯµÄ×Ö¶ÎÃ÷È·Ö¸³ö±íÃû¡£¾¡Á¿²»ÒªÊ¹ÓÃSELECT *Óï¾ä¡£×éÖ¯SQLÓï¾äµÄʱºò£¬¾¡Á¿°´ÕÕÊý¾Ý¿âµÄÏ°¹ß½øÐÐ×éÖ¯


Ïà¹ØÎĵµ£º

SQLÒ»¸ö´æ´¢¹ý³Ìµ÷ÓÃÁíÒ»¸ö´æ´¢¹ý³Ì »ñµÃ·µ»ØÖµÎÊÌâ

µÚÒ»ÖÖ·½·¨: ʹÓÃoutput²ÎÊý
USE AdventureWorks;
GO
IF OBJECT_ID ( 'Production.usp_GetList', 'P' ) IS NOT NULL
    DROP PROCEDURE Production.usp_GetList;
GO
CREATE PROCEDURE Production.usp_GetList @product varchar(40)
    , @maxprice money
    , ......

°²×°SQL Serverºó±Ø×ö12²½

12 Essential Steps After Installing SQL Server
By : Sadequl Hussain
Jul 13, 2009
 
from: http://www.sql-server-performance.com/articles/dba/post_installation_steps_p1.aspx
Rolling out SQL Servers is a key task for
DBAs.  While for some DBAs this can be a frequent exercise, others wi ......

PL/SQL³£Óþ䷨

1¡¢Ñ­»·²åÈë²âÊÔÊý¾Ý£º
SQL>
declare
maxrecords constant int:=100;
i int :=1;
Begin
for i in 1..maxrecords loop

--²åÈëÊý¾Ý
Insert into TEST.EXAMPLE(name,phone,address) values('·ÖÒ³²âÊÔÊý¾Ý....','ÁªÏµµç»°','ÁªÏµµØÖ·');
end loop;
commit;
end;
´Ë´¦EXAMPLE±í¶¨ÒåΪ(ID number,name ......

SQLÖеÄIF ELSE£¨CASEÓï¾äµÄʹÓã©

----start
    ´ó¼Ò¶ÔIF ELSEÓï¾ä¿ÉÄܶ¼ºÜÊìϤ£¬ËüÊÇÓÃÀ´¶Ô¹ý³Ì½øÐпØÖƵġ£ÔÚSQLµÄÊÀ½çÖÐCASEÓï¾äÓï¾äÓÐÀàËƵÄЧ¹û¡£ÏÂÃæ¼òµ¥µÄ½éÉÜCASEÓï¾äµÄÓ÷¨¡£¿¼ÂÇÏÂÃæµÄÇé¿ö£¬¼ÙÉèÓиöuser±í£¬¶¨ÒåÈçÏ£º
CREATE TABLE USER
(
NAME VARCHAR(20) NOT NULL,---ÐÕÃû
SEX INTEGER,---ÐÔ±ð£¨1¡¢ÄÐ 2¡¢Å®£©
BIRTHDA ......

¶¨Ê±ÖØÆôSQL ServerºÍTomcat

¶¨Ê±ÖØÆôSQL ServerºÍTomcat
[http://hi.baidu.com/personnel/blog/item/020d5edf020a281248540306.html]
¶¨Ê±ÖØÆôSQL ServerºÍTomcat
2007-06-07 08:23
ÒÔǰûÓÐ×Ô¼º¹ÜÀí·þÎñÆ÷»¹²»ÖªµÀ£¬SQL Server·þÎñÆ÷µÄÄÚ´æËæ×ÅÔËÐеÄʱ¼äÔö³¤¶ø²»¶ÏÔö³¤¡£
ÓÃÁËÒ»Á½ÌìÖ®ºó·¢ÏÖ½ø³ÌÖеÄSQL ServerÒѾ­Õ¼ÓÃÁ˽ü1.3GµÄÄڴ棬ÄÚ´æÒ»¹ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ