日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Oracle常用的命令中Oracl的相關(guān)數(shù)據(jù)類型列舉

以下的文章主要是介紹Oracle常用的命令中Oracl的相關(guān)數(shù)據(jù)類型,本文也涉及到一些相關(guān)的實(shí)際應(yīng)用代碼,以代碼的方式來引出Oracle常用的命令中Oracl的相關(guān)數(shù)據(jù)類型,以下就是文章的具體介紹。

創(chuàng)新互聯(lián)建站專業(yè)提供成都主機(jī)托管四川主機(jī)托管成都服務(wù)器托管四川服務(wù)器托管,支持按月付款!我們的承諾:貴族品質(zhì)、平民價(jià)格,機(jī)房位于中國電信/網(wǎng)通/移動(dòng)機(jī)房,成都二樞機(jī)房服務(wù)有保障!

 

 
 
 
  1. Create table test1(name char(10),sex char(1));  
  2. Insert into test1 values(‘tomcatt北京’,’f’);  
  3. Create table test2(name nchar(10),sex nchar(1));  
  4. Insert into test2 values(‘tomcatt北京’,’男’);  

 

刪除表 drop table 表名;

 

 
 
 
  1. Create table test3(name varchar2(10),sex varchar2(2));  
  2. Insert into test3 values(‘tomcatt北京’,’f’);  

插入值過大

 

 
 
 
  1. Insert into test3 values(‘tomcat北京’,’f’);  
  2. Create table test4(name varchar2(10),age number(3),salary number(8,2));  
  3. Create table test5(name varchar2(10),birth date);  
  4. Insert into test5 values(‘Tom’,’28-2月-08’);  
  5. Insert into test5 values(‘Allen’,sysdate);  
  6. DDL:  

 

創(chuàng)建表

 

 
 
 
  1. create table scott.test6(  
  2. eid number(10),  
  3. name varchar2(20),  
  4. hiredate date default sysdate,  
  5. salary number(8,2) default 0  
  6. )  

 

插入數(shù)據(jù)時(shí)若沒有指定hiredate,salary的話則會(huì)取默認(rèn)值

Oracle常用命令數(shù)據(jù)字典:

Dba-所有方案包含的對(duì)象信息

All-用戶可以訪問的對(duì)象信息

User-用戶方案的對(duì)象信息

 

 
 
 
  1. Select * from user_tables;  
  2. Select * from all_tables;  

 

約束:

域完整性約束:not null check

實(shí)體完整性約束:unique primary key

參照完整性約束:foreign key

視圖:

 

 
 
 
  1. Create or replace view v1(eid,name,salary) as select 
    empno,ename,sal from emp where deptno = 30; 

序列:sequence

 

 
 
 
  1. Create sequence mysequence1 increment by 1 start 
    with 1 nomaxvalue nocycle;  
  2. Insert into test values(mysequence1.nextval,’tom’);  
  3. Create sequence student_sequence start with 1 increment by 1;  
  4. Insert into student values(student_sequence.nextval,’john’);  

 

Oracle常用命令表間數(shù)據(jù)拷貝:

 

 
 
 
  1. Insert into dept1(id,name) select deptno,dname from dept; 

實(shí)例(創(chuàng)建表 ID字段自增):

 

 
 
 
  1. --create table test2(id char(10) primary key not null, name char(10));  
  2. --create sequence test2_sequence increment by 1 start with 1 nomaxvalue nocycle;  
  3. --insert into test2 values(test2_sequence.nextval,'john');  
  4. --insert into test2 values(test2_sequence.nextval,'allen');  
  5. --insert into test2 values(test2_sequence.nextval,'candy');  
  6. --insert into test2 values(test2_sequence.nextval,'aaaa');  
  7. --insert into test2 values(test2_sequence.nextval,'bbbbb');  
  8. --insert into test2 values(test2_sequence.nextval,'cccccc');  
  9. --insert into test2 values(test2_sequence.nextval,'ddddd');  
  10. --insert into test2 values(test2_sequence.nextval,'eeeee');  
  11. --insert into test2 values(test2_sequence.nextval,'ggggg');  
  12. --insert into test2 values(test2_sequence.nextval,'jowwwwhn');  
  13. --insert into test2 values(test2_sequence.nextval,'aaaadd');  
  14. --insert into test2 values(test2_sequence.nextval,'ggghhh');  
  15. --insert into test2 values(test2_sequence.nextval,'eeettt');  
  16. --insert into test2 values(test2_sequence.nextval,'wwwttt');  
  17. select * from test2;  

 

查看表結(jié)構(gòu)

EDITDATA 表名;

修改表字段:

Alter table 表名 modify(字段名 類型 約束);

 

 
 
 
  1. alter table test modify (addd varchar2(10) null); 

alter table 表名 add(字段名 類型 約束);

 

 
 
 
  1. alter table test add(age varchar2(5)); 

【編輯推薦】

  1. Oracle應(yīng)用的程序開發(fā)趨于向Web的緣由
  2. Oracle RAC中錯(cuò)誤觀點(diǎn)出現(xiàn)的原因
  3. Oracle客戶關(guān)系管理論壇的內(nèi)容簡介
  4. Oracle常用命令的列舉
  5. Oracle常用的命令如何查看表的結(jié)構(gòu)

名稱欄目:Oracle常用的命令中Oracl的相關(guān)數(shù)據(jù)類型列舉
標(biāo)題網(wǎng)址:http://www.dlmjj.cn/article/djjdsgo.html