oracleÁ·Ï°Ì⣨mldnÊÓƵ£©Ò»
1,Áгö×îµÍн½ð´óÓÚ1500µÄ¸÷ÖÖ¹¤×÷¼°´ÓÊ´˹¤×÷µÄÈ«²¿¹ÍÔ±ÈËÊý¡£
select job,count(empno) from emp
where job in(select job from emp group by job having min(sal)>1500)
group by job;
2£¬Áгöн½ð¸ßÓÚ¹«Ë¾Æ½¾ùн½ðµÄËùÓÐÔ±¹¤ËùÔÚ²¿ÃÅ£¬Éϼ¶Áìµ¼£¬¹«Ë¾µÄ¹¤×ʵȼ¶¡£
select e.ename,d.dname,m.ename,e.sal,sa.grade
from emp e,emp m,dept d,(select avg(sal) avg from emp) ed,salgrade sa
where e.mgr=m.empno(+) and e.deptno=d.deptno and e.sal >ed.avg and (e.sal between losal and hisal);
3£¬ÁгöÓëscott´ÓÊÂÏàͬ¹¤×÷µÄËùÓÐÔ±¹¤¼°²¿ÃÅÃû³Æ¡£
select e.ename,d.dname from emp e,dept d,(select job from emp where ename='SCOTT') ed
where e.job=ed.job and e.deptno=d.deptno and ename!='SCOTT';
4,ÁгöËùÓв¿ÃŵÄÏêϸÐÅÏ¢ºÍ²¿ÃÅÈËÊý¡£
select d.*,nvl(ed.cou,0)
from dept d,(select deptno,count(empno) cou from emp group by deptno) ed
where d.deptno=ed.deptno(+);
5,Áгö¸÷ÖÖ¹¤×÷µÄ×îµÍ¹¤×ʼ°´ÓÊ´˹¤×÷µÄ¹ÍÔ±ÐÕÃû(δÄܽ«Ïàͬ¹¤×ʵÄÈËÅųý£©¡£
select e.ename,e.job,e.sal
from emp e,(select min(sal) min from emp group by job) ed
where e.sal=ed.min;
6,Áгö¸÷¸ö²¿ÃŵÄmanager£¨¾Àí£©µÄ×îµÍн½ð(²éѯ³öµÄÊǸ÷¸ö²¿ÃŵľÀíµÄ¹¤×Ê£¬ÒòΪÿ¸ö²¿ÃÅÖ»ÓÐÒ»¸ö¾Àí)¡£
select deptno,min(sal) from emp where job='MANAGER' group by deptno;
7,ÁгöËùÓÐÔ±¹¤µÄÄ깤×Ê£¬°´Äêн´ÓµÍµ½¸ßµÄ˳ÐòÅÅÐò¡£
select ename,((sal+nvl(comm,0))*12) sa from emp order by sa asc;
8,²é³öÿ¸öÔ±¹¤µÄÉϼ¶Ö÷¹Ü£¬²¢ÒªÇó³öÕâЩÖ÷¹ÜÖеÄнˮ³¬¹ý3000µÄ¡£
select distinct m.ename,m.sal
from emp e,emp m
where e.mgr=m.empno and m.sal>3000;
9,Çó³ö²¿ÃÅÃû³ÆÖдø'S'×Ö·ûµÄ²¿ÃÅÔ±¹¤µÄ¹¤×ʺϼƣ¬²¿ÃÅÈËÊý¡£
select distinct e.deptno,d.dname,ed.sum,ed.cou
from emp e,dept d,
(select deptno,sum(sal) sum,count(empno) cou from emp group by deptno) ed
where d.dname like '%S%' and e.deptno=ed.deptno and e.deptno=d.deptno;
10,¸øÈÎÖ°ÈÕÆÚ³¬¹ý29ÄêµÄÈ˼Óн10%¡£
update emp set sal=sal*1.1 where (sysdate-hiredate)/365>29;(¸üÐÂÊý¾Ý)
select ename,sal*(1+0.1) salh from emp where (sysdate-hiredate)/365>29;£¨½ö½öÊDzéѯ¼ÓнºóÊý¾Ý£©
11,ÁгöÔÚ²¿ÃÅ"SALES"(ÏúÊÛ²¿)¹¤×÷µÄÔ±¹¤µ
Ïà¹ØÎĵµ£º
ʵÏÖ·½·¨£º
1¡¢¿ªÊ¼->ÉèÖÃ->¿ØÖÆÃæ°å->¹ÜÀí¹¤¾ß->·þÎñ
Í£Ö¹ËùÓÐOracle·þÎñ¡£
2¡¢¿ªÊ¼->³ÌÐò->Oracle - OraHome81->Oracle Installation Products->
Universal Installer
жװËùÓÐOracle²úÆ·£¬µ«Universal Installer±¾Éí²»Äܱ»É¾³ý
5¡¢ÔËÐÐregedit£¬Ñ¡ÔñHKEY_LOCAL_MACHINESOFTWAREORACLE£¬°´ ......
´¦Àí·½·¨Ò» £º
¼ì²éÄǸö±í±»Ëø
select sess.sid,sess.serial#, lo.oracle_username,lo.os_user_name,ao.object_name,lo.locked_mode
from v$locked_object lo,dba_objects ao,v$session sess
where ao.object_id = lo.object_id
and lo.session_id = sess.sid;
½âËø
alter system kill session '273,45';
´¦Àí·½·¨¶ ......
Æäʵ´´½¨dgÍøÂçÉϵÄÎĵµºÜ¶à£¬ÎÒÊÇ¿´Ð¡²¼ÀÏʦÊÇÊÓƵѧϰµÄ
ÓÃÐéÄâ»ú×ö²âÊÔ£¬ÅªÁ˺ü¸Ì죬ÏÂÃæ¼Ç¼һÏÂÔø¾×ö¹ýÓ¡Ïó±È½ÏÉîµÄµØ·½
1.½«Primary·þÎñÆ÷´¦Óڹ鵵ģʽºÍForce Loggingģʽ
SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP MOUNT;
SQL> ALTER DATABASE ARCHIVELOG;
SQL> ALTER DATABASE OPEN;
S ......
empÔ±¹¤±í
(empnoÔ±¹¤ºÅ/enameÔ±¹¤ÐÕÃû/job¹¤×÷/mgrÉϼ¶±àºÅ/hiredateÊܹÍÈÕÆÚ/salн½ð/commÓ¶½ð/deptno²¿ÃűàºÅ)
------1.Ñ¡Ôñ²¿ÃÅ30ÖеÄËùÓÐÔ±¹¤.
select ename
from emp
where deptno = 30;
------2.ÁгöËùÓаìÊÂÔ±(CLERK)µÄÐÕÃû£¬±àºÅºÍ²¿ÃűàºÅ.
select ename,empno,deptno
from emp
where job='CLERK';
--- ......
Oracle Database 10g Release 2 (10.2.0.1.0) Enterprise/Standard Edition for Microsoft Windows (32-bit)
http://download.oracle.com/otn/nt/oracle10g/10201/10201_database_win32.zip
http://download.oracle.com/otn/nt/oracle10g/10201/10201_client_win32.zip
http://download.oracle.com/otn/nt/oracle10g/10 ......