回覆列表
  • 1 # 用戶1380628807025197

    1、創建兩張測試表,

    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的記錄,

  • 中秋節和大豐收的關聯?
  • 2023大蒜為什麼貴?