oracle ±Ê¼Ç
1. SQL Óï¾äÓëSQL*Plus ÃüÁî
SQL
SQL*Plus
Ò»ÖÖÓïÑÔ
Ò»ÖÖ»·¾³
ANSI±ê×¼
Oracle µÄÌØÐÔÖ®Ò»
¹Ø¼ü×Ö²»ÄÜËõд
¹Ø¼ü×Ö¿ÉÒÔËõд
ʹÓÃÓï¾ä¿ØÖÆÊý¾Ý¿âÖеıíµÄ¶¨ÒåÐÅÏ¢
ºÍ±íÖеÄÊý¾Ý
ÃüÁî²»ÄܸıäÊý¾Ý¿âÖеÄÊý¾ÝµÄÖµ
¼¯ÖÐÔËÐÐ
2.ÒÔϼ¸¸ö²éѯºÜÖØÒª£¬×ÐϸÌå»á
1 (ÓÐÔ±¹¤µÄ³ÇÊÐ)¸÷¸ö³ÇÊеÄƽ¾ù¹¤×Ê
select city,avg(salary) from employees e,departments d locations l
where e.department_id = d.department_id and d.location_id = l.location_id group by city;
2 ²éѯÄÄЩ³ÇÊÐÓÐÔ±¹¤£¬ÄÄЩ³ÇÊÐûÓÐÔ±¹¤
select city from employees e,departments d,locations l
where e.department_id = d.department_id and d.location_id = l.location_id
group by city having count(employee_id) > 0
1)×麯Êý²»ÄÜ·ÅÔÚ where×Ó¾äÖУ¬ ÐèÒª·ÅÔÚ having ×Ó¾äÖÐ
2) Ðè°´ city ½øÐзÖ×é
3 manager ÖÐ×î¸ß¹¤×ÊÊÇË manager ÖÐ×îµÍ¹¤×ÊÊǶàÉÙ manager ÖÐƽ¾ù¹¤×ÊÊǶàÉÙ
Ê×ÏÈҪȷ¶¨ÄÄЩÈËÊÇmanager
¹«Ë¾ÓÐÄÄЩÈËÊÇ manager :
·½°¸1
select distinct m.employee_id,m.last_name from employees e,employees m
where e.manager_id = m_employee_id order by m.employee_id
·½°¸2
select distinct manager_id from employees where manager_id is not null order by manager_id
ƽ¾ù¹¤×Ê:
select avg(m.salary) from employees e,employees m
where e.manager_id = m.employee_id order by m.employee_id
×î¸ß¹¤×Ê:
/*
select max(m.salary) from employees e,employees m
where e.manager_id= m.employee_id order by m.employee_id
*/
¿ÉÒÔÓÃ×Ó²éѯ
select last_name,salary from employees where salary =
(select max(m.salary) from employees e,employees m where e.manager_id = m.employee_id )
order by employee_id
5. Ñ¡ÔñËùÓÐÔ±¹¤µÄÐÕÃû£¬Ô±¹¤ºÅ£¬ÒÔ¼°ËûµÄ¹ÜÀíÕßµÄÐÕÃûºÍÔ±¹¤ºÅ£¬½á¹ûÀàËÆÓÚÏÂÃæµÄ¸ñʽ
--------------------
Ïà¹ØÎĵµ£º
oracleʵÀýÆô¶¯Ê±¶ÁÈ¡pfile²ÎÊýÎļþ£¬ÐÞ¸Äpfile³õʼ»¯²ÎÊýÎļþºó£¬±ØÐëÖØÐÂÆô¶¯ÊµÀý²ÅÄÜÉúЧ¡£
pfile²ÎÊýÎļþÓëspfile²ÎÊýÎļþ¶¼ÊÇÓÃÀ´´æ·Å³õʼ»¯²ÎÊýµÄÎïÀíÎļþ£¬pfileÒÔÎı¾ÎļþµÄÐÎʽ´æ´¢£¬ÓŵãÊÇÒ×Óڲ鿴ÓëÐ޸ģ»spfileÒÔ¶þ½øÖƵÄÐÎʽ´æ´¢£¬ËäÈ»ÄÜʵÏÖÒÔʵÀ ......
Êý¾Ý×Öµädict×ÜÊÇÊôÓÚOracleÓû§sysµÄ¡£
¡¡¡¡1¡¢Óû§£º
¡¡¡¡¡¡select username from dba_users;
¡¡¡¡¸Ä¿ÚÁî
¡¡¡¡¡¡alter user spgroup identified by spgtest;
¡¡¡¡2¡¢±í¿Õ¼ä£º
¡¡¡¡¡¡select * from dba_data_files;&nbs ......
½çÃ濪·¢ÈËÔ±±¨ÓкܶàÖظ´Êý¾ÝÔÚÓû§È¨ÏÞ±í¡£È»ºóÎÒɾ³ýÁ˱íÊý¾Ýdelete ·½Ê½£¬ÐÞ¸ÄÁ˶ÔÓ¦µÄ´æ´¢¹ý³Ìʹ֮²»Öظ´£¡
ºóÀ´·¢ÏÖ ÖØÐÂÀ»ØµÄÊý¾ÝûȨÏÞ¡£ Ö»ºÃÉÁ»Øµ½½ñÌìÁ賿ÁË£¡
SQL> ALTER TABLE BA.T_POWER_ADMIN ENABLE ROW MOVEMENT;
Table altered
SQL> flashback table ba.t_Power_Admin to tim ......
µ¼¶Á£º
¡¡¡¡2009Äê9ÔÂOracle¹«Ë¾·¢²¼ÁËÆÚ´ýÒѾõÄOracle 11g R2£¬±¾ÏµÁÐÎÄÕ½«¸ø¶ÁÕßÒ»Ò»½Ò¿ªÐ°汾ÖеÄÐÂÌØÐÔ£¬²¢»á½éÉÜÆóÒµÈçºÎÀûÓÃÕâЩÐÂÌØÐÔ½«ÏÖÓеÄOracle 9i£¬10g£¬11g R1Éý¼¶µ½Oracle 11g R2.
¡¡¡¡¾ÀúÁËÄÑÒÔÈÌÊܵij¤Ê±¼äµÈ´ý£¬Oracle¹«Ë¾Í»È»ÔÚ9ÔÂ1·¢²¼ÁËOracle 11g R2£¬ÎÒ²»µÃ²»³ÐÈÏOracleµÄ±£Ãܹ¤×÷×öµÃ ......