以下の内容はhttps://htn20190109.hatenablog.com/entry/2024/11/02/144604より取得しました。


{データベースの作成その他}参照整合性制約を設定

 


https://docs.oracle.com/cd/F19136_01/sqlrf/ALTER-TABLE.html


drop table tab1 purge;
drop table tab2 purge;

create table tab1(col1 int, col2 int);
create table tab2(col1 int, col2 int, col3 int);

alter table tab1 add constraint pk1 primary key(col1);
alter table tab2 add constraint pk2 primary key(col1,col2);


alter table tab2 add constraint fk21 foreign key (col1) references tab1(col1);


select * from user_constraints where table_name like 'TAB%' and constraint_type = 'P';

select * from user_constraints where table_name like 'TAB%' and constraint_type = 'R';

 

 




以上の内容はhttps://htn20190109.hatenablog.com/entry/2024/11/02/144604より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14