真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

oracle常規(guī)操作

1、創(chuàng)建表

Sql代碼  oracle常規(guī)操作

成都創(chuàng)新互聯(lián)公司是專業(yè)的卓尼網(wǎng)站建設(shè)公司,卓尼接單;提供成都做網(wǎng)站、網(wǎng)站設(shè)計(jì),網(wǎng)頁(yè)設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行卓尼網(wǎng)站開(kāi)發(fā)網(wǎng)頁(yè)制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛(ài)的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來(lái)合作!

  1. create table test(  

  2.   id varchar2(10),  

  3.   age number  

  4. );  


2、備份表

Sql代碼  oracle常規(guī)操作

  1. create table   

  2. as   

  3. select * from test group by id;  

 3、刪除表

Sql代碼  oracle常規(guī)操作

  1. drop table test;--刪除表結(jié)構(gòu)和表數(shù)據(jù)  


4、清空表

Sql代碼  oracle常規(guī)操作

  1. truncate table test;--清空數(shù)據(jù)表數(shù)據(jù),沒(méi)有返回余地  

  2. delete from test;---清空數(shù)據(jù)表數(shù)據(jù),有返回余地  

 

5、添加字段下載

Sql代碼  oracle常規(guī)操作

  1. alter table test add (  

  2.   name varchar2(10),  

  3.   interest varchar2(20)  

  4. );  


6、刪除字段

Sql代碼  oracle常規(guī)操作

  1. alter table test drop name;  


7、更新數(shù)據(jù)

7.1更新一條數(shù)據(jù)

Sql代碼  oracle常規(guī)操作

  1. update test t   

  2. set t.id='001'   

  3. where t.id is not null;  

  4. commit;  

 

7.2從其他表更新多條數(shù)據(jù)

Sql代碼 下載 oracle常規(guī)操作

  1. update test t set t.name=(  

  2.   select tm.name   

  3.     from test_common tm   

  4.   where t.id=tm.id  

  5. );  

  6. commit;  

  7. --備注:update數(shù)據(jù)時(shí),最好將update子查詢中的sql單獨(dú)建表,提高更新速度。  

 

7.3在PL/SQL中查詢完數(shù)據(jù)直接進(jìn)入編輯模式更改數(shù)據(jù)

Sql代碼  oracle常規(guī)操作

  1. select * from test for update;  

  2. --備注:更新操作執(zhí)行完,要鎖上數(shù)據(jù)表,同時(shí)執(zhí)行commit提交操作  

 

8、查詢數(shù)據(jù)

Sql代碼  oracle常規(guī)操作

  1. select * from test;  

 9、查詢數(shù)據(jù)表數(shù)量

Sql代碼  下載

  1. select count(0) from test;  

  2. --備注:count(0)或者其他數(shù)字比count(*)更加節(jié)省數(shù)據(jù)庫(kù)資源,高效快捷  


10、插入數(shù)據(jù)

10.1插入一條數(shù)據(jù)中的多個(gè)字段

Sql代碼  oracle常規(guī)操作

  1. insert into test (C1,C2) values(1,'技術(shù)部');  

Sql代碼  oracle常規(guī)操作

  1. insert into test(C1,C2) select C1,C2 from test_common;  

  2. commit;  

 

10.2插入多條數(shù)據(jù)

Sql代碼  oracle常規(guī)操作

  1. insert into test(  

  2.   id,  

  3.   name,  

  4.   age  

  5. )  

  6. select  

  7.   id,  

  8.   name,  

  9.   age  

  10. from test_common;  

  11. commit;  

  12. --備注:1、插入多條數(shù)據(jù)時(shí),insert into語(yǔ)句后面沒(méi)有values,直接拼接數(shù)據(jù)查詢語(yǔ)句;2、在oracle中對(duì)數(shù)據(jù)表進(jìn)行了insert、update、delete等操作后,要執(zhí)行commit提交,否則在系統(tǒng)處是禁止操作數(shù)據(jù)庫(kù)的,因?yàn)榇藭r(shí)數(shù)據(jù)庫(kù)已經(jīng)被鎖死,這是數(shù)據(jù)庫(kù)為了防止多人同時(shí)修改數(shù)據(jù)庫(kù)數(shù)據(jù)造成混亂的一種防范機(jī)制。  


新聞名稱:oracle常規(guī)操作
本文網(wǎng)址:http://weahome.cn/article/gsiodc.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部