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. Ñ¡ÔñËùÓÐÔ±¹¤µÄÐÕÃû£¬Ô±¹¤ºÅ£¬ÒÔ¼°ËûµÄ¹ÜÀíÕßµÄÐÕÃûºÍÔ±¹¤ºÅ£¬½á¹ûÀàËÆÓÚÏÂÃæµÄ¸ñʽ
--------------------
Ïà¹ØÎĵµ£º
½çÃ濪·¢ÈËÔ±±¨ÓкܶàÖظ´Êý¾ÝÔÚÓû§È¨ÏÞ±í¡£È»ºóÎÒɾ³ýÁ˱íÊý¾Ýdelete ·½Ê½£¬ÐÞ¸ÄÁ˶ÔÓ¦µÄ´æ´¢¹ý³Ìʹ֮²»Öظ´£¡
ºóÀ´·¢ÏÖ ÖØÐÂÀ»ØµÄÊý¾ÝûȨÏÞ¡£ Ö»ºÃÉÁ»Øµ½½ñÌìÁ賿ÁË£¡
SQL> ALTER TABLE BA.T_POWER_ADMIN ENABLE ROW MOVEMENT;
Table altered
SQL> flashback table ba.t_Power_Admin to tim ......
¡¡¡¡Ò»¡¢Ê²Ã´ÊÇMTS
¡¡¡¡MTS = Multi-Threaded ServerMTSÊÇORACLE SERVERµÄÒ»¸ö¿ÉÑ¡µÄÅäÖÃÑ¡Ôñ£¬ÊÇÏà¶ÔDEDICATE·½Ê½¶øÑÔ£¬Ëü×î´óµÄÓŵãÊÇÔÚÒÔ²»ÓÃÔö¼ÓÎïÀí×ÊÔ´(ÄÚ´æ)µÄÇ°ÌáÏÂÖ§³Ö¸ü¶àµÄ²¢·¢µÄÁ¬½Ó¡£Joseph C.JohnsonÒԲ͹ݸø³öÒ»¸öMTSµÄÐÎÏóµÄ±ÈÓ÷
¡¡¡¡¼ÙÉèORACLEÊÇÒ»¼Ò²Í¹Ý£¬µ±Äã×ß½øÒ»¼Ò²Í¹ÝʱÄã¸Ð¾õ×îÊæ·þµÄ·þÎñ·½Ê½¾ÍÊ ......
ËÄ¡¢ÁªºÏÊý×éµÄʹÓ÷½·¨
ÁªºÏÊý×éÒÔÇ°±»³ÆΪPL/SQL±í¡£ÔÚ±íÖв»ÄÜʹÓÃÁªºÏÊý×飬ֻÄܽ«ËüÃÇÓÃ×÷³ÌÐòÉè¼ÆµÄ½á¹¹Ìå¡£Ö»ÄÜÔÚPL/SQLÖзÃÎÊÁªºÏÊý×é¡£
×¢Òâµ½ÁªºÏÊý×é´øÀ´µÄһЩ¹Ø¼üÎÊÌâÊǷdz£ÖØÒªµÄ¡£ÕâЩÎÊÌâʹÎÒÃǽéÉÜËüÃǵÄÓ÷¨Ê±£¬ÐèÒª²ÉȡһЩÌرðµÄ·½·¨¡£ÕâЩÎÊÌâ°üÀ¨£º
ÁªºÏÊý×é²»ÐèÒª³õʼ»¯£¬Ò²Ã»Óй¹Ô캯ÊýÓï·¨¡£ÔÚ ......
ÕâƪÎÄÕÂÊÇORACLEÃæÊÔµÄÎÊÌâ½õ¼¯£¬ËäÈ»²»È«Ã棬µ«ÊÇÕâƪÎÄÕ»áÈÃÄãÖªµÀÈçºÎÈÃÃæÊÔ¿¼¹ÙÁ˽âÄã¶ÔORACLE¸ÅÄîµÄÊìϤ³Ì¶È¡£
1.½âÊÍÀ䱸·ÝºÍÈȱ¸·ÝµÄ²»Í¬µãÒÔ¼°¸÷×ÔµÄÓŵã
½â´ð£ºÈȱ¸·ÝÕë¶Ô¹éµµÄ£Ê½µÄÊý¾Ý¿â£¬ÔÚÊý¾Ý¿âÈԾɴ¦ÓÚ¹¤×÷״̬ʱ½øÐб¸·Ý¡£¶øÀ䱸·ÝÖ¸ÔÚÊý¾Ý¿â¹Ø±Õºó£¬½øÐб¸·Ý£¬ÊÊÓÃÓÚËùÓÐÄ£Ê ......