ORACLE ÐÐתÁÐ ²âÊÔͨ¹ý£¨9i£©
--ORACLE ÐÐתÁÐ ²âÊÔͨ¹ý£¨9i£©
/***************************************************************************************************
ÒÔѧÉú³É¼¨ÎªÀý×Ó£¬±È½ÏÐÎÏóÒ×¶®
***********************************************************************************************************/
--1¡¢ÐÐתÁÐ
--> --> Éú³É²âÊÔÊý¾Ý
drop table Class ;
Create table Class(Student varchar2(20),Course varchar2(20),Score number) ;
Insert into Class
(
select 'ÕÅÈý','ÓïÎÄ',78 from dual union all
select 'ÕÅÈý','Êýѧ',87 from dual union all
select 'ÕÅÈý','Ó¢Óï',82 from dual union all
select 'ÕÅÈý','ÎïÀí',90 from dual union all
select 'ÀîËÄ','ÓïÎÄ',65 from dual union all
select 'ÀîËÄ','Êýѧ',77 from dual union all
select 'ÀîËÄ','Ó¢Óï',65 from dual union all
select 'ÀîËÄ','ÎïÀí',85 from dual );
--case ·½Ê½:
select Student,sum(ÓïÎÄ) ÓïÎÄ,sum(Êýѧ) Êýѧ,sum(ÎïÀí) ÎïÀí,sum(Ó¢Óï) Ó¢Óï
from(
select Student,
case Course when 'ÓïÎÄ' then Score else 0 end as ÓïÎÄ,
case Course when 'Êýѧ' then Score else 0 end as Êýѧ,
case Course when 'ÎïÀí' then Score else 0 end as ÎïÀí,
case Course when 'Ó¢Óï' then Score else 0 end as Ó¢Óï
from Class )
group by Student;
--decode ·½Ê½:
select student,sum(decode(Course,'ÓïÎÄ', Score,0)) as ÓïÎÄ,
sum(decode(Course,'Êýѧ', Score,0)) as Êýѧ,
sum(decode(Course,'ÎïÀí', Score,0)) as ÎïÀí,
sum(decode(Course,'Ó¢Óï', Score,0)) as Ó¢Óï
from Class
group by student;
drop table Class ;
Ïà¹ØÎĵµ£º
ѧϰOracle DBAÒ²°ë¸ö¶àѧÆÚÁË£¬½ñÌìÃÍÈ»²Å·¢ÏÖ£¬ÔÀ´ÎÒµÄÊ黹ÊǺÜеģ¬ÉϿβÙ×÷ʱºòÒ²Ö»ÊÇÖªµÀ´ó¸ÅÔõô×ö£¬µ«ÊÇÒªÕæµÄÈ«²¿×Ô¼º×ö£¬¶ø²»È¥·Ê黹ÊÇÓÐÒ»¶¨µÄÄѶȵģ¬ËùÒÔÄØ£¬½ñÌ쿪ʼ½«DBA´ÓÍ·¸´Ï°Ò»±é£¬Í¬Ê±ÔÙ²Ù×÷Ò»±é¡£
µÚÒ»Õ£¬Ñ§µÄÊÇOracleµÄÌåϵ½á¹¹£ ......
[ÕªÒª]Ö÷Òª´Ó´óÐÍÊý¾Ý¿âORACLE»·¾³Ëĸö²»Í¬¼¶±ðµÄµ÷Õû·ÖÎöÈëÊÖ£¬·ÖÎöORACLEµÄϵͳ½á¹¹ºÍ¹¤×÷»úÀí£¬´Ó²»Í¬·½Ãæ½ÏÈ«ÃæµØ×ܽáORACLEÊý¾Ý¿âµÄÓÅ»¯µ÷Õû·½°¸¡£
[¹Ø¼ü´Ê]ORACLEÊý¾Ý¿â¡¢»·¾³µ÷Õû¡¢ÓÅ»¯Éè¼Æ¡¢·½°¸
ÖÐͼ·ÖÀàºÅ£ºTP3 ÎÄÏ×±êʶÂ룺A ÎÄÕ±àºÅ£º1671£7597(2008)0720043£01
¡¡¡¡
¡¡¡¡ORACLEÊý¾Ý¿âÖÐÊý¾Ý´æÈ¡ÐÔÄ ......
¹Ø¼ü´Ê:
°ó¶¨±äÁ¿(binding variable),¹²Ïí³Ø(shared buffer pool), SGA(system global area);
ÔÚ¿ª·¢Ò»¸öÊý¾Ý¿âϵͳǰ,ÓÐ˶ÔOracle ϵͳÁ˽âºÜ¶à,ÓÈÆäÊÇËüµÄÌØÐÔ,ºÃÏóºÜÉÙ°É;¶Ô³õѧÕßÀ´½²,Õâ¸üÊDz»¿ÉÄܵÄÊÂÇé;½ö½ö¼òµ¥ÕÆÎÕÁËSQLµÄд·¨,¾Í¿ªÊ¼ÁËÊý¾Ý¿âµÄ¿ª·¢,Æä½á¹ûÖ»ÄÜÊÇ¿ª·¢Ò»¸öûÓÐЧÂÊ,ҲûÓпÉÀ©Õ¹µÄϵͳ;
Òò´Ë,ÎÒ ......
ÔÚÃüÁî¸ñʽÏ£¬½øÈësqlplusµÄ±à¼×´Ì¬ÖÐ
£¨1£©²é¿´¿ØÖÆÎļþµÄÄÚÈÝ£º
SQL> DESC v$controlfile
Ãû³Æ &n ......
Ê×ÏÈ£¬ÄãÒªÓÐÒ»ÕÅ±í£¡
CREATE TABLE example(
ID Number(4) NOT NULL PRIMARY KEY,
NAME VARCHAR(25),
  ......