freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

oracle語(yǔ)法大全-資料下載頁(yè)

2025-05-13 18:57本頁(yè)面
  

【正文】 number constraint test_pk_pk primary key, name varchar2(25) )。 上面的代碼給約束起了一個(gè)名字 方便約束的管理 上面的約束直接跟在列的后面 稱之為列級(jí)約束 create table test_pk( id number , name varchar2(25), constraint test_pk_pk primary key(id) )。 列級(jí)別直接跟在列的后面寫起來(lái)比較方便 表級(jí)別約束是所有的字段都定義完成之后 再對(duì) 字段進(jìn)行限定 做聯(lián)合主鍵 create table test_pk( id number , name varchar2(25), constraint test_pk_pk primary key(id,name) )。 把唯一性約束按照列級(jí)別約束和表級(jí)別約束 唯一性約束 unique 但要求字段的值唯一 可以為空 個(gè)數(shù)不限制 create table test_pk( id number , name varchar2(25), constraint test_pk_id_un primary key(id) )。 非空約束: not null 因?yàn)榉强占s束太簡(jiǎn)單了 簡(jiǎn)單到?jīng)]有表級(jí)約束 create table test_pk( id number , name varchar2(25) not null, constraint test_pk_id_un primary key(id) )。 檢查約束: check create table test_pk( id number , salary number constraint test_pk_salary_c check(salary1000) )。 insert into test_pk values(1,1001)。 把上面的列級(jí)約束改成表級(jí) create table test_pk( id number , salary number, constraint test_pk_salary_c check(salary1000) )。 外鍵約束:foreign key 兩張表 A 一張普通表 有主鍵叫aid (父表) B(子表) 有兩個(gè)字段 一個(gè)是主鍵bid 還有一個(gè) 字段fid和A表主鍵有關(guān)系 fid 的取值受限于A表 fid 的值只能是A表aid 這一列中有的值 或者fid的取值是NULL 后建子表 create table f_parent( aid number primary key )。 create table f_child( bid number primary key, fid number references fk_parent(aid) )。 create table f_child( bid number primary key, fid number constraint f_child_fid_f references f_parent(aid) )。 create table f_child( bid number primary key, fid number constraint fk_child_fid_fk foreign key f_parent(aid) )。 //error 一般先向父表插入數(shù)據(jù) 也可以先向子表插入外鍵是NULL insert into f_child values(1,NULL)。 insert into f_child values(2,1)。 insert into f_parent values(1)。 更新 刪除表中的數(shù)據(jù) update 表名 set 字段名=值,字段名=值 where id=1。 delete from 表名 where id=值。 update fk_child set fid=2 where bid=1。 一般先更新父表 要么只能把fid 更新為NULL 刪除數(shù)據(jù)? 先刪除子表 再刪除父表中的數(shù)據(jù) 如果想刪父表的數(shù)據(jù) 以后會(huì)有相應(yīng)的技術(shù) 一般先刪子表 后刪父表 如果想先刪父表 drop table fk_parent cascade constraints。 其實(shí)原理上也是先解除父子表關(guān)系 然后再刪父表 外鍵的表級(jí)約 create table fk_child( bid number primary key, fid number, constraint fk_child_fid_fk foreign key(fid) references fk_parent(aid) )。 //聯(lián)合外鍵 create table fk_child( bid number primary key, fid number, ffid number, constraint fk_child_fid_fk foreign key(fid,ffid) references fk_parent(aid,aaid) )。 aaid 必須有唯一性的特點(diǎn) create table fk_parent( aid number , aaid number, unique(aid,aaid) )。 //兩個(gè)外鍵? 看提供的腳本 如何建立多個(gè)表級(jí)約束 on delete cascade id=42 部門解散 員工開(kāi)除 on delete set null 部門解散 員工部門為NULL 但不開(kāi)除 create table fk_parent( aid number primary key )。 insert into fk_parent values(1)。 //刪除父表數(shù)據(jù) 子表級(jí)聯(lián)刪除 create table fk_child( bid number primary key, fid number references fk_parent(aid) on delete cascade )。 insert into fk_parent values(1)。 insert into fk_child values(1,1)。 create table fk_parent( aid number primary key )。 insert into fk_parent values(1)。 //刪除父表數(shù)據(jù) 子表級(jí)聯(lián)置空 create table fk_child( bid number primary key, fid number references fk_parent(aid) on delete set null )。 insert into fk_parent values(1)。 insert into fk_child values(1,1)。 oracle 不支持級(jí)聯(lián)更新 ----觸發(fā)器 dml: insert insert into 表名(字段名,字段名) values(字段對(duì)應(yīng)的值)。 必須包含所有的非空列 insert into 表名 values(全部字段對(duì)應(yīng)值)。 用desc 出現(xiàn)的順序 create table tes_dml( id number primary key,《《選擇性插入時(shí)必須有它》》************ name varchar2(25), salary number )。 insert into tes_dml values(1,39。tt39。,12300)。 insert into tes_dml(id,salary) values(2,12800)。 insert into test_dml(name,salary) values(39。test39。,12800)。//error*****************《《《把一個(gè)表中的數(shù)據(jù)插入到另一個(gè)表中》》》》》********** insert into tes_dml select id,last_name,salary from s_emp。 insert into test_dml(id,salary) select id,salary from s_emp where id10。 //上面的sql 不要出現(xiàn)values update update 表名 set 字段=值,字段=值 where delete delete from 表名 where 條件 把上面的三種sql 統(tǒng)稱dml dml 有事務(wù)特性。建表的高級(jí)語(yǔ)法: create table test_create as select id ,last_name from s_emp。 create table test_create as select id ,last_name from s_emp where 1=1。 //只有表結(jié)構(gòu) 沒(méi)有數(shù)據(jù)《《創(chuàng)建空表》》****************** create table test_create as select id ,last_name from s_emp where 1=2。 事務(wù): oracle 的安裝: 不能有中文路徑 事務(wù) 交易dml的事務(wù)默認(rèn)是非自動(dòng)提交ddl 事務(wù)是自動(dòng)提交的A 20000如果自動(dòng)提交 A轉(zhuǎn)賬后 就立即確認(rèn)B +20000A B+A B 事務(wù)開(kāi)始上一次的提交 或者回滾AB+事務(wù)的結(jié)束原子性 一起成功 一起失敗事務(wù)的結(jié)束 本次事務(wù) 提交或者回滾mit。 確認(rèn)提交rollback。放棄之前的操作 隔離性 沒(méi)確認(rèn)之前是獨(dú)立的 互不干擾的(select) 對(duì)表來(lái)講 兩個(gè)事務(wù)共享 表級(jí)共享鎖 但對(duì)dml操作的同一行來(lái)講 行是排它的 行級(jí)排它鎖oracle 有一個(gè)專門的區(qū)域放未提交的數(shù)據(jù)一致性 持久性向表中插入一條數(shù)據(jù) 再執(zhí)行建表 或者刪表語(yǔ)句自己測(cè)試在另一個(gè)事務(wù)中 看數(shù)據(jù)提交與否?ddl 事務(wù)是自動(dòng)提交的保存點(diǎn) 是對(duì)事務(wù)的補(bǔ)充 dml savepoint a。 dml rollback to a。 mit。序列:sequence create sequence test_dml_pk。 開(kāi)始值是1 可以依次增長(zhǎng) select from dual。 insert into test_dml values(,39。tt39。,100)。 [INCREMENT BY n] 1 [START WITH n] 1 [{MAXVALUE n | NOMAXVALUE}] [{MINVALUE n | NOMINVALUE}] [{CYCLE | NOCYCLE}] NOCYCLE [{CACHE n | NOCACHE}] 20 user_sequences create sequence my_seq increment by 5 start with 8 maxvalue 50 cycle cache 3。 create sequence my_seq2
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評(píng)公示相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1