展开全部
1、创建32313133353236313431303231363533e59b9ee7ad9431333431373864两张测试表,
create table test_cj(name VARCHAR(20), remark varchar2(20));
create table test_kc(name VARCHAR(20), remark varchar2(20));
2、插入测试数据
insert into test_cj values('xh','cj_1');
insert into test_cj values('kcdh','cj_2');
insert into test_cj values('cj','cj_3');
insert into test_kc values('kcdh','kc_1');
insert into test_kc values('kcm','kc_2');
3、查询两张表的总记录数,select t.*, rowid from test_cj t union all select t.*, rowid from test_kc t,
4、编写sql,两张表进行关联,select t.name, t.remark, b.remark from test_cj t, test_kc b where t.name=b.name,可以发现关联出kcdh的记录,