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

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²Ù×÷Óï¾ä£º
1.´´½¨±í
create table ±íÃû(
 ÁÐÃû1 ÀàÐÍ£¬
 ÁÐÃû2 ÀàÐÍ
);
2.ÐÞ¸ÄÀàÊôÐÔ
alter table ±íÃû modify(ÁÐÃû ÀàÐÍ);
3.Ìí¼ÓÁÐ
alter table ±íÃû add(ÁÐÃû ÀàÐÍ);
4.Ìí¼ÓÖ÷¼üÔ¼ÊøºÍ·Ç¿ÕÔ¼Êø
alter table ±íÃû add constraint pk_±íÃû primary key(ÁÐÃû);
alter table ±íÃû modify(ÁÐÃû not null);
5.ɾ³ýÖ÷¼üÔ¼Êø
alter table ±íÃû drop primary key;
alter table ±íÃû drop constraint pk_±íÃû;
6.ʧЧԼÊø
alter table ±íÃû disable primary key;
alter table ±íÃû disable constraint pk_±íÃû;
7.ÓÐЧԼÊø
alter table ±íÃû enable primary key;
alter table ±íÃû enable constraint pk_±íÃû;
8.ɾ³ýÁÐ
alter table ±íÃû drop column ÁÐÃû;
9.ÉèÖÃijÁв»¿ÉÓã¬È»ºóɾ³ý
alter table ±íÃû set unused(ÁÐÃû);
alter table ±íÃû drop unused columns;
10.Ð޸ıíÃû
rename ±íÃû1 to ±íÃû2
alter ±íÃû1 rename to ±íÃû2;
11.½Ø¶Ï±í
truncate table ±íÃû;
12.½Ø¶Ï±í±£ÁôÐпռä
truncate table ±íÃû resue storage;
13.²é¿´±í½á¹¹
desc table ±íÃû;
14.ɾ³ý±í
drop table ±íÃû;
15.²åÈë¼Ç¼
Àý£ºinsert into ±íÃû values(ÄÚÈÝ1,ÄÚÈÝ2,ÄÚÈÝ3,ÄÚÈÝ4);
16.´ø²ÎÊý¶Ô»°·½Ê½²åÈëÐÐ
Àý:insert into ±íÃû values(&ÁÐÃû1,&ÁÐÃû2);
  insert into ±íÃû values(ÄÚÈÝ1,ÄÚÈÝ2);
17.²åÈëij¼¸ÁмǼ
insert into ±íÃû(ÁÐÃû1,ÁÐÃû2) values(ÄÚÈÝ1,ÄÚÈÝ2);
18.ΪÁвåÈë¿ÕÖµ£¨ÆäÁв»ÄÜΪnot null£©
insert into ±íÃû values(ÄÚÈÝ1,null,null);
19.´´½¨±í£¨°üÀ¨Ö÷¼ü¼°Íâ¼üÉèÖã©·½·¨Ò»
create table ±íÃû(
  ÁÐÃû1 ÀàÐÍ
  constraint pk_±íÃû primary key,
  ÁÐÃû2 ÀàÐÍ not null,
  ÁÐÃû3 ÀàÐÍ 
  constraint fk_±íÃû reference ±íÃû(ÁÐÃû),
  ÁÐÃû3 ÀàÐÍ
  constraint


Ïà¹ØÎĵµ£º

Oracle SQL*PlusµÄ»·¾³ÅäÖ㨸ü¸ÄÐÐ¿í£©

µ±ÎÒÃÇÓÃoracleµÄSQL*Plus¹¤¾ßÊäÈësqlÓï¾äµÄʱºò£¬SQL*PlusµÄĬÈÏÉèÖÃ×ÜÓÐЩ²»ºÏÀíµÄµØ·½£¬´ËʱÎÒÃÇͨ¹ýÒÔÏÂһЩ·½·¨¸Ä½ø£º
1¡¢¿ÉÒÔÔËÓÃSQL*Plus×ÔÉíһЩÓï¾ä¸Ä±ä»·¾³²ÎÊý¡£
     SQL>  set linesize 900 ;   /* ¸ü¸ÄÏÔʾµÄ¿í¶È, ÉèÖóÉ900ºó, Ò»ÐÐÊý¾Ý¾Í²»»á·ÖÁ½ÐÐÏÔʾÁË */
&nb ......

SQLÓï¾äЧÂÊÎÊÌâµÄ¼¸µã×ܽá

 1. SQLÓÅ»¯µÄÔ­ÔòÊÇ£º
  ½«Ò»´Î²Ù×÷ÐèÒª¶ÁÈ¡µÄBLOCKÊý¼õµ½×îµÍ,¼´ÔÚ×î¶ÌµÄʱ¼ä´ïµ½×î´óµÄÊý¾ÝÍÌÍÂÁ¿¡£  
  µ÷Õû²»Á¼SQLͨ³£¿ÉÒÔ´ÓÒÔϼ¸µãÇÐÈ룺  
  ¼ì²é²»Á¼µÄSQL£¬¿¼ÂÇÆäд·¨ÊÇ·ñ»¹ÓпÉÓÅ»¯ÄÚÈÝ  
  ¼ì²é×Ó²éѯ   ¿¼ÂÇSQL×Ó²éѯÊÇ·ñ¿ÉÒÔÓüòµ ......

oracle to_date,to_char,trunc,decodeÓ÷¨

select decode('X','Q','±äÁ¿1','±äÁ¿2') from dual
¡¡select sysdate,to_char(sysdate,’yyyy-mm-dd hh24:mi:ss’) from dual
¡¡
¡¡select to_date(’2003-10-17 21:15:37’,’yyyy-mm-dd hh24:mi:ss’) from dual  
ÈÕÆÚ¸ñʽ²ÎÊý º¬Òå˵Ã÷
D Ò»ÖÜÖеÄÐÇÆÚ¼¸
DAY ÌìµÄÃû ......

Flash »á±íÊý¾Ý Ö®oracle 10g

½çÃ濪·¢ÈËÔ±±¨ÓкܶàÖظ´Êý¾ÝÔÚÓû§È¨ÏÞ±í¡£È»ºóÎÒɾ³ýÁ˱íÊý¾Ýdelete ·½Ê½£¬ÐÞ¸ÄÁ˶ÔÓ¦µÄ´æ´¢¹ý³Ìʹ֮²»Öظ´£¡
ºóÀ´·¢ÏÖ ÖØÐÂÀ­»ØµÄÊý¾ÝûȨÏÞ¡£ Ö»ºÃÉÁ»Øµ½½ñÌìÁ賿ÁË£¡
SQL> ALTER TABLE BA.T_POWER_ADMIN ENABLE ROW MOVEMENT;
 
Table altered
 
SQL> flashback table ba.t_Power_Admin to tim ......

OracleÓÃimpºÍexpʵÏÖÊý¾ÝµÄµ¼ÈëºÍµ¼³ö

 ImpºÍExp
ÃüÁîÏê½â:
Exp
µ¼³ö
ģʽ:
Fullģʽ---µ¼³ö
Õû¸öÊý¾Ý¿â
Userģʽ---µ¼³ö
Ö¸¶¨µÄÓû§
Tableģʽ—µ¼³ö
Ö¸¶¨µÄ±í
Tablespaceģʽ—µ¼³ö
±í
¿Õ¼ä
Exp
µ¼³ö
²ÎÊý:
OWNERÖ¸¶¨Òªµ¼³ö
µÄÓû§Áбí
FULL=y±íʾҪµ¼³ö
Õû¸öÊý¾Ý¿â
TablesÖ¸¶¨Òªµ¼³ö
µÄ±í
TablepacesÖ¸¶¨Òªµ¼³ö
µÄ±í ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ