美文网首页
hive的简单的关联查询

hive的简单的关联查询

作者: 你的努力时光不会辜负 | 来源:发表于2022-01-25 10:35 被阅读0次

    CREATE TABLE testdb1 (
    id int,
    name string,
    age int,
    pdate string
    )
    WITH (format = 'ORC')

    CREATE TABLE testdb2 (
    id int,
    name string,
    pdate string
    )
    WITH (format = 'ORC')

    insert into testdb1 values (1,'Alice',24,'20210529')
    insert into testdb1 values (2,'Bob',16,'20210529')
    insert into testdb1 values (3,'Tom',23,'20210529')
    insert into testdb1 values (4,'Lili',21,'20210529')
    insert into testdb2 values (1,'Alice','20210529')
    insert into testdb2 values (3,'Bob','20210529')
    insert into testdb2 values (6,'Zidane','20210529')

    select *
    FROM
    testdb1 a inner join testdb2 b
    on
    a.name = b.name

    select *
    FROM
    testdb1 a left join testdb2 b
    on
    a.name = b.name

    select *
    FROM
    testdb1 a right join testdb2 b
    on
    a.name = b.name

    select *
    FROM
    testdb1 a full join testdb2 b
    on
    a.name = b.name

    来源:https://blog.csdn.net/fangfanglovezhou/article/details/117364145

    相关文章

      网友评论

          本文标题:hive的简单的关联查询

          本文链接:https://www.haomeiwen.com/subject/snhwhrtx.html