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

oracle ÊÓƵ±Ê¼Ç1(select)

ÏÂÃæÊÇÓÃscottÓû§²âÊԵġ£
Èç¹û²»ÖªµÀµ±Ç°Óû§ÊÇʲôÓû§,¿ÉÒÔÊäÈë: show user ,ÕâÑùËü¾ÍÏÔʾ³öµ±Ç°Óû§ÊÇʲôÓû§ÁË.
Èç¹ûÏë±à¼­ÒѾ­ÊäÈëµ½sqlplusÖеĴúÂë,¿ÉÒÔÊäÈë“ed”£¬È»ºó»Ø³µ¾ÍÄܵ¯³öÒ»¸ö¼Çʱ¾£¬¼Çʱ¾ÀïÃæÓÐÉÏÒ»²½ÊäÈëµÄ´úÂë,Ð޸ĴúÂë²¢±£´æºó¹Ø±Õ¼Çʱ¾,×îºóÔÚsqlplusÖÐÊäÈë“/”²¢»÷»Ø³µ¾ÍÖ´ÐÐÁË¡£
1.²»µÈÓÚºÅÊÇ:<>
Èç:select ename, sal from emp where deptno <> 10;
2.SQLÖеÄ×Ö·û´®´óСд²»Ò»Ñù
Èç:select ename ,sal from emp where ename = 'CLASD';
Óë select ename ,sal from emp where ename = 'clasd';
ÊDz»Ò»ÑùµÄ.
3.between Óë >=ºÍ<=
Èç: select ename, sal from emp where sal between 800 and 1500; µÄÒâ˼Óë
select ename, sal from emp where sal >= 800 and sal <= 1500; Ò»Ñù
4.°Ñ¿Õֵѡ³öÀ´
Èç: select ename, sal, comm from emp where comm is null;
5.°Ñ·Ç¿Õֵѡ³öÀ´
Èç: select ename, sal, comm from emp where comm is not null;
6.inµÄÓ÷¨
Èç:select ename, sal, comm from emp where sal in (800, 1500, 2000); Òâ˼ÊÇ°ÑsalµÈÓÚ800 »òÕß1500»òÕß2000µÄ ename¡¢sal¡¢comm ÄóöÀ´¡£
select ename, sal, comm from emp where sal not in (800, 1500, 2000); Òâ˼ÊÇ°Ñsal²»µÈ
800»òÕß1500»òÕß2000µÄename¡¢sl¡¢comm ÄóöÀ´¡£
7.ÈÕÆÚ:1981Äê2ÔÂ20ÈÕÒÔºóµÄ±íʾΪ: select ename, sal, hiredate from emp where hiredate > '20-2ÔÂ-81'; »ò:select ename, sal, hiredate from emp where hiredate > '20-2ÔÂ-1981';
ÏÈת»»¸ñʽÔÙÈ¡ÈÕÆÚÓëʱ¼ä:select ename, hiredate from emp where hiredate > to_date('1981-2-20 12:34:56', 'YYYY-MM-DD HH24:MI:SS');
8.»òÕßµÄÁ¬½ÓÓÃ"or"
Èç:select ename, sal, comm from emp where sal>1000 or deptno=10;
9.Ä£ºý²éÕÒ:like±íʾģºý²éÕÒ,"%"±íʾÁã¸ö»ò¶à¸ö×Öĸ,"_"´ú±íÒ»¸ö×Öĸ.
Èç:select ename from emp where ename like '%ALL%'; ±íʾ²éÕÒ·ûºÏALLÇ°ÃæºÍºóÃæÓÐÁã¸ö»ò¶à ¸ö×ÖĸµÄename;
select ename from emp where ename like '_A%';±íʾ²éÕÒ·ûºÏÿ¶þ¸ö×ÖĸÊÇAµÄename;
²éÕÒ´øÓÐ%µÄ×Ö·û´®,ÓÃתÒå×Ö·û"\",Èç:select ename from emp where ename like '%\%%';±íʾ²éÕÒ ´øÓÐ"%"µÄ×Ö·û´®¡£Ò²¿ÉÒÔ×Ô¼ºÉèÖà תÒå×Ö·û£¬È磺select ename from emp where ename like '%$%' escape '$'; ±í


Ïà¹ØÎĵµ£º

OracleÃÜÂëÎļþµÄ×÷ÓúÍ˵Ã÷


ÔÚÊý¾Ý¿âδÆô¶¯Ö®Ç°µÇ½´Ó¶øÆô¶¯Êý¾Ý¿âÈç¹ûûÓпÚÁîÎļþ£¬ÔÚÊý¾Ý¿âδÆô¶¯Ö®Ç°¾ÍÖ»ÄÜͨ¹ý²Ù×÷ϵͳÈÏÖ¤.ʹÓÃRman£¬ºÜ¶àʱºòÐèÒªÔÚnomount,mountµÈ״̬¶ÔÊý¾Ý¿â½øÐд¦Àí¡£ËùÒÔͨ³£ÒªÇósysdbaȨÏÞÈç¹ûÊôÓÚ±¾µØDBA×飬¿ÉÒÔͨ¹ý²Ù×÷ϵͳÈÏÖ¤µÇ½Èç¹ûÊÇÔ¶³ÌsysdbaµÇ½£¬ÐèҪͨ¹ýpasswordfileÈÏÖ¤¡£
1.remote_login_passwordfile ......

Ò»¸öÐÞ¸ÄOracleÓû§ÃÜÂëµÄС¾÷ÇÏ

 Êý¾Ý¿â°æ±¾£º9.2.0.5
¡¡¡¡ÓÐʱºòÎÒÃÇ¿ÉÄܲ»ÖªµÀÒ»¸öÓû§µÄÃÜÂ룬µ«ÊÇÓÖÐèÒªÒÔÕâ¸öÓû§×öһЩ²Ù×÷£¬ÓÖ²»ÄÜÈ¥Ð޸ĵôÕâ¸öÓû§µÄÃÜÂ룬Õâ¸öʱºò£¬¾Í¿ÉÒÔÀûÓÃһЩСÇÏÃÅ£¬À´Íê³É²Ù×÷¡£
¡¡¡¡¾ßÌå²Ù×÷¹ý³ÌÈçÏ£º
¡¡¡¡SQL*Plus: Release 9.2.0.5.0 - Production on ÐÇÆÚÈÕ 11ÔÂ 21 13:32:34 2004
¡¡¡¡Copyright (c) 1982, ......

Oracle Óï·¨Ö® OVER (PARTITION BY ..) ¼°¿ª´°º¯Êý


oracleµÄ·ÖÎöº¯Êýover ¼°¿ª´°º¯Êý
Ò»£º·ÖÎöº¯Êýover
Oracle´Ó8.1.6¿ªÊ¼Ìṩ·ÖÎöº¯Êý£¬·ÖÎöº¯ÊýÓÃÓÚ¼ÆËã»ùÓÚ×éµÄijÖÖ¾ÛºÏÖµ£¬ËüºÍ¾ÛºÏº¯ÊýµÄ²»Í¬Ö®´¦ÊÇ
¶ÔÓÚÿ¸ö×é·µ»Ø¶àÐУ¬¶ø¾ÛºÏº¯Êý¶ÔÓÚÿ¸ö×éÖ»·µ»ØÒ»ÐС£
ÏÂÃæͨ¹ý¼¸¸öÀý×ÓÀ´ËµÃ÷ÆäÓ¦Óᣠ          &nb ......

oracleÖÐconnect by priorʵÏֵݹé²éѯ

ÊÕ¼¯µÄ¼¸ÌõÔÚoracleÖÐͨ¹ýconnect by priorÀ´ÊµÏֵݹé²éѯ
Start with...Connect By×Ó¾äµÝ¹é²éѯһ°ãÓÃÓÚÒ»¸ö±íά»¤Ê÷ÐνṹµÄÓ¦Óá£
´´½¨Ê¾Àý±í£º
CREATE TABLE TBL_TEST
(
ID    NUMBER,
NAME VARCHAR2(100 BYTE),
PID   NUMBER         ......

OracleÖÐDecode()º¯ÊýʹÓü¼ÇÉ


¡¡¡¡decode()º¯ÊýÊÇORACLE PL/SQLÊǹ¦ÄÜÇ¿´óµÄº¯ÊýÖ®Ò»£¬Ä¿Ç°»¹Ö»ÓÐORACLE¹«Ë¾µÄSQLÌṩÁ˴˺¯Êý£¬ÆäËûÊý¾Ý¿â³§É̵ÄSQLʵÏÖ»¹Ã»Óд˹¦ÄÜ¡£
      DECODEº¯ÊýÊÇORACLE PL/SQLÊǹ¦ÄÜÇ¿´óµÄº¯ÊýÖ®Ò»£¬Ä¿Ç°»¹Ö»ÓÐORACLE¹«Ë¾µÄSQLÌṩÁ˴˺¯Êý£¬ÆäËûÊý¾Ý¿â³§É̵ÄSQLʵÏÖ»¹Ã»Óд˹¦ÄÜ¡£DECODEÓÐÊ²Ã´Ó ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ