Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

oracle ±Ê¼Ç II Ö®DML:Êý¾Ý²Ù×÷ÓïÑÔ

 DML:Data Manipulation Language Êý¾Ý²Ù×÷ÓïÑÔ
°üÀ¨£ºCRUD
1. insertÓï¾ä
(1) ´ÓÆäËü±íÖи´ÖÆÊý¾Ý,ʵÏÖ·½·¨:ÔÚinsert Óï¾äÖмÓÈë²éѯÓï¾ä
insert into sales_reps(id,name,salary,commission_pct)  select employee_id,last_name,salary,commission_pct
from employees where job_id like '%rep';
(2) updateÖÐʹÓÃ×Ó²éѯ
 update employees set job_id =  (select job_id from employees where employee_id = 205),
                               salary =  (select salary from employees where employee_id = 205)
           where employee_id = 114;
   È磺¸üÐÂ114ºÅÔ±¹¤µÄ¹¤×÷ºÍ¹¤×ÊʹÆäÓë205ºÅÔ±¹¤Ïàͬ
   update employees set job_id =  (select job_id from employees where employee_id = 205),
      salary = (select salary from employees where employee_id = 205)
      where employee_id = 114
   ÔÙ¿´Ò»¸öÎÊÌ⣬×ÐϸÌå»á½â¾ö²½Ö裺
    ¸ü¸Ä 108 Ô±¹¤µÄÐÅÏ¢: ʹÆä ¹¤×ʱäΪËùÔÚ²¿ÃÅÖеÄ×î¸ß¹¤×Ê£¬job±äΪ¹«Ë¾ÖÐÆ½¾ù¹¤×Ê×îµÍµÄjob
     ·ÖÎö£º
 µÚ1 ²½ Ê×ÏȲéѯ 108 ËùÔÚ²¿ÃŵÄ×î¸ß¹¤×ÊÊǶàÉÙ
    select max(salary) from employees where department_id =
  ( select department_id from employees where employee_id = 108)
 µÚ 2 ²½ ²éѯ¹«Ë¾ÖÐÆ½¾ù¹¤×Ê×îµÍµÄ job_id
     select job_id from employees group by job_id having avg(salary) =
     (select min(avg_sal) from(select avg(salary) avg_sal from employees  group by job_id) )
 µÚ 3 ²½ ʵÏÖ¸üÐÂ
          update employees set salary = (  select max(salary) from employees 
             where department_id =


Ïà¹ØÎĵµ£º

oracle ±í¿Õ¼ä²Ù×÷

oracle±í¿Õ¼ä²Ù×÷Ïê½â
  1
  2
  3×÷Õߣº   À´Ô´£º    ¸üÐÂÈÕÆÚ£º2006-01-04 
  5
  6 
  7½¨Á¢±í¿Õ¼ä
  8
  9CREATE TABLESPACE data01
 10DATAFILE '/ora ......

Oracle³£ÓÃSQLÓï¾ä(PL/SQL developer¹¤¾ßϵÄ)

 ½¨±í
create table users(
id number(4) primary key,
username varchar2(10),
password varchar2(10)
)
²éѯ±í²¢½âËø±í(¼´¿ÉÒÔµã»÷ÊäÈë¿òÏÂÃæµÄ"Ëø"ͼ±ê¹¤¾ß, ¼´"Edit data")
select * from users for update
ɾ³ý±íÖжàÓàµÄÁÐ
alter table mobilephone drop column mobiletype
×ªÔØ
------------------- ......

OracleÊý¾Ý¿âÃæÊÔÎÊÌ⼯ºÏ¼°¼¼ÇÉ

 
ÕâÆªÎÄÕÂÊÇORACLEÃæÊÔµÄÎÊÌâ½õ¼¯£¬ËäÈ»²»È«Ã棬µ«ÊÇÕâÆªÎÄÕ»áÈÃÄãÖªµÀÈçºÎÈÃÃæÊÔ¿¼¹ÙÁ˽âÄã¶ÔORACLE¸ÅÄîµÄÊìϤ³Ì¶È¡£
 
1.½âÊÍÀ䱸·ÝºÍÈȱ¸·ÝµÄ²»Í¬µãÒÔ¼°¸÷×ÔµÄÓŵã
 
½â´ð£ºÈȱ¸·ÝÕë¶Ô¹éµµÄ£Ê½µÄÊý¾Ý¿â£¬ÔÚÊý¾Ý¿âÈԾɴ¦ÓÚ¹¤×÷״̬ʱ½øÐб¸·Ý¡£¶øÀ䱸·ÝÖ¸ÔÚÊý¾Ý¿â¹Ø±Õºó£¬½øÐб¸·Ý£¬ÊÊÓÃÓÚËùÓÐÄ£Ê ......

ORACLE SQLÓï¾äÓÅ»¯×ܽá

ORACLE SQLÓï¾äÓÅ»¯×ܽá
 
1£© Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
ORACLEµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏÂ,Äã±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í¡£Èç¹ûÓÐ3¸öÒÔÉϵıíÁ¬½Ó²éѯ, Ä ......

oracle ³£ÓòéѯÃüÁî

 Êý¾Ý×Öµädict×ÜÊÇÊôÓÚOracleÓû§sysµÄ¡£
1¡¢Óû§£º
¡¡select username from dba_users;
¸Ä¿ÚÁî
¡¡alter user spgroup identified by spgtest;
2¡¢±í¿Õ¼ä£º
¡¡select * from dba_data_files;
¡¡select * from dba_tablespaces;//±í¿Õ¼ä
¡¡select tablespace_name,sum(bytes), sum(blocks)
from dba_ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ