0
点赞
收藏
分享

微信扫一扫

数仓开发LAG 和 LEAD 函数详细解析和用例

Hive官方文档 join table 总结

join_table:
    table_reference [INNER] JOIN table_factor [join_condition]
  | table_reference {LEFT|RIGHT|FULL} [OUTER] JOIN table_reference join_condition
  | table_reference LEFT SEMI JOIN table_reference join_condition
  | table_reference CROSS JOIN table_reference [join_condition] (as of Hive 0.10)

上述是Hive官方列出的表join操作形式,以下是对每种join操作形式的总结说明:

  1. INNER JOIN

    • INNER JOIN 用于返回两个表中互相匹配的行。
    • 语法: table_reference INNER JOIN table_factor [join_condition]
  2. LEFT JOIN / RIGHT JOIN / FULL JOIN

    • LEFT JOIN 、 RIGHT JOIN 和 FULL JOIN 用于执行外连接操作。
    • LEFT JOIN 返回左表中的所有行以及右表中与左表匹配的行。
    • RIGHT JOIN 返回右表中的所有行以及左表中与右表匹配的行。
    • FULL JOIN 返回两个表中的所有行,如果某一行在另一个表中没有匹配,则返回 NULL 值。
    • 语法: table_reference {LEFT|RIGHT|FULL} [OUTER] JOIN table_reference join_condition
  3. LEFT SEMI JOIN

    • LEFT SEMI JOIN 用于返回左表中与右表匹配的行,但不返回右表的数据。
    • 语法: table_reference LEFT SEMI JOIN table_reference join_condition
  4. CROSS JOIN

    • CROSS JOIN 用于返回两个表的笛卡尔积(交叉连接),即左表的每一行与右表的每一行组合。
    • 语法: table_reference CROSS JOIN table_reference [join_condition]

Hive Join 官方链接地址:https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Joins

举报

相关推荐

0 条评论