SQL> create table a(aid number,name varchar(10),constraint pk_a_id primary key(a
id));
表已创建。
SQL> create table b(bid number,name varchar(10),constraint pk_b_id primary key(b
id));
表已创建。
SQL> create table c(cid number,aid number,bid number,constraint pk_c_id primary
key(cid));
表已创建。
SQL> create index i_c_aid on c(aid);
索引已创建。
SQL> create index i_c_bid on c(bid);
索引已创建。
SQL> alter session set optimizer_goal=rule
2 ;
会话已更改。
SQL> insert into a values(1,'first');
已创建 1 行。
SQL> insert into a values(2,'second');
已创建 1 行。
SQL> insert into b values(1,'bfirst');
已创建 1 行。
SQL> insert into b values(2,'bsecond');
已创建 1 行。
SQL> insert into c values(1,1,1);
已创建 1 行。
SQL> insert into c values(2,1,2);
已创建 1 行。
SQL> insert into c values(3,2,2);
已创建 1 行。
SQL> insert into c values(4,2,1);
已创建 1 行。
SQL> select * from a;
AID NAME
---------- ----------
1 first
2 second
SQL> select * from b;
BID NAME
---------- ----------
1 bfirst
2 bsecond
SQL> select * from c;
CID AID BID