Oracleѧϰ±Ê¼Çժ¼2
µ¥Ðк¯Êý ·µ»ØÖµÖ»ÓÐÒ»¸ö
·Ö×麯Êý ·µ»ØÖµÊǶàÌõ¼Ç¼
group by
sum
avg
µ¥Ðк¯Êý
×Ö·ûº¯Êý
concat Á¬½Ó ||
<1>ÏÔʾdnameºÍlocÖмäÓÃ-·Ö¸ô
select deptno,dname||'----'||loc from dept;
dualÑÆÔª±í ûÓбíÐèÒª²éѯµÄʱºò ¿ÉÒÔÓÃËü
select 'Hello World' from dual;
select 1+1 from dual;
²éѯϵͳʱ¼ä
select sysdate from dual;
<2> initcap Ê××Öĸ´óд
select ename,initcap(ename) from emp;
<3> lower ת»»ÎªÐ¡Ð´×Ö·û
select ename,lower(ename) from emp;
<4> upper ת»»Îª´óд
update dept set loc=lower(loc);
update dept set loc=upper(loc);
<5> LPAD ×óÌî³ä
select deptno,lpad(dname,10,' '),loc from dept;
<6> RPAD ÓÒÌî³ä
<7> LTRIM È¥³ý×ó±ßµÄ¿Õ¸ñ
RTRIM È¥³ýÓұߵĿոñ
ALLTRIM È¥³ýÁ½±ßµÄ¿Õ¸ñ
<8>replace Ìæ»»
translate ת»»
select ename,replace(ename,'S','s') from emp;
ÓÃ'
Ïà¹ØÎĵµ£º
Ò»¡¢PL/SQL³öÏÖµÄÄ¿µÄ
¡¡¡¡½á¹¹»¯²éѯÓïÑÔ(Structured Query
Language£¬¼ò³ÆSQL)ÊÇÓÃÀ´·ÃÎʹØϵÐÍÊý¾Ý¿âÒ»ÖÖͨÓÃÓïÑÔ£¬ËüÊôÓÚµÚËÄ´úÓïÑÔ£¨4GL£©£¬ÆäÖ´ÐÐÌصãÊǷǹý³Ì»¯£¬¼´²»ÓÃÖ¸Ã÷Ö´ÐеľßÌå·½·¨ºÍ;
¾¶£¬¶øÊǼòµ¥µÄµ÷ÓÃÏàÓ¦Óï¾äÀ´Ö±½ÓÈ¡µÃ½á¹û¼´¿É¡£ÏÔÈ»£¬ÕâÖÖ²»¹Ø×¢ÈκÎʵÏÖϸ½ÚµÄÓïÑÔ¶ÔÓÚ¿ª·¢ÕßÀ´ËµÓÐ׿«´óµÄ ......
10gÊý¾Ý¿â½éÉÜ£º¿ÉÒÔʹÓøü¶àеÄoptimizer hintsÀ´¿ØÖÆÓÅ»¯ÐÐΪ¡£ÏÖÔÚÈÃÎÒÃÇ¿ìËÙ½âÎöÒ»ÏÂÕâЩǿ´óµÄÐÂhints:
spread_min_analysis
ʹÓÃÕâÒ»hint£¬Äã¿ÉÒÔºöÂÔһЩ¹ØÓÚÈçÏêϸµÄ¹ØϵÒÀÀµÍ¼·ÖÎöµÈµç×Ó±í¸ñµÄ±àÒëʱ¼äÓÅ»¯¹æÔò¡£ÆäËûµÄһЩÓÅ»¯£¬Èç´´½¨¹ýÂËÒÔÓÐÑ¡ÔñÐԵĶ¨Î»µç×Ó±í¸ñ·ÃÎʽṹ²¢ÏÞÖÆÐÞ¶©¹æÔòµÈ£¬µÃµ ......
ºÜ¶àÅóÓÑÖ»ÓÃÁËOracleµÄɾ³ý£¬µ«ºÜ¶àÇé¿öÏ£¬Ëû»á·¢ÏÖÖØа²×°Ê±£¬µãÁËÏÂÒ»²½°²×°½çÃæ¾ÍÏûʧÁË£¬ÍùÍùÎÞÄÎÏÂÖ»ºÃÖØװϵͳ£¬ÆäʵֻÊÇÄãÊý¾Ý¿âûɾ¸É¾»£¬É¾¸É¾»¾Í²»»á³öÏÖÕâÖÖÇé¿öÁË¡£
¡¡¡¡ÊµÏÖ·½·¨£º
¡¡¡¡1¡¢¿ªÊ¼->ÉèÖÃ->¿ØÖÆÃæ°å->¹ÜÀí¹¤¾ß->·þÎñÍ£Ö¹ËùÓÐOracle·þÎñ¡£
¡¡¡¡2¡¢¿ªÊ¼->³ÌÐò->Oracl ......
1¡¢´´½¨ÐòÁÐÓï·¨£º(ÐèÒªCREATE SEQUENCEϵͳȨÏÞ)
CREATE SEQUENCE ÐòÁÐÃû
[INCREMENT BY n] ---ÓÃÓÚ¶¨ÒåÐòÁеIJ½³¤¡£
......
1.create alter insert update selectµÈ
ÈçºÎ½¨±í
ѧÉú±ístudent
create table student( --ѧÉú±í
xh number(4), --ѧºÅ
  ......