zoukankan      html  css  js  c++  java
  • hive-连接查询

    • 内连接查询
    hive> select * from customer as c , orderInfo as o where c.id = o.cid;
    11      tom1    1       cc      price1  11
    12      tom2    2       dd      price2  12
    12      tom2    3       ss      price3  12
    13      tom3    4       ff      price4  13
    • 左连接查询
    hive> select * from customer c left join orderInfo o on c.id = o.cid;#以c.id为主  展示所有的c.id
    11      tom1    1       cc      price1  11
    12      tom2    2       dd      price2  12
    12      tom2    3       ss      price3  12
    13      tom3    4       ff      price4  13
    14      tom4    NULL    NULL    NULL    NULL
    15      tom5    NULL    NULL    NULL    NULL
    
    • 右连接查询
    hive> select * from customer c right join orderInfo o on c.id = o.cid;#以o.id为主  展示所有的o.id
    11      tom1    1       cc      price1  11
    12      tom2    2       dd      price2  12
    12      tom2    3       ss      price3  12
    13      tom3    4       ff      price4  13
    
    • 全连接查询
    hive> select * from customer c full join orderInfo o on o.cid = c.id;#保留所有基表的数据
    11      tom1    1       cc      price1  11
    12      tom2    3       ss      price3  12
    12      tom2    2       dd      price2  12
    13      tom3    4       ff      price4  13
    14      tom4    NULL    NULL    NULL    NULL
    15      tom5    NULL    NULL    NULL    NULL
    
    欢迎关注我的公众号:小秋的博客 CSDN博客:https://blog.csdn.net/xiaoqiu_cr github:https://github.com/crr121 联系邮箱:rongchen633@gmail.com 有什么问题可以给我留言噢~
  • 相关阅读:
    jquery web 國際化
    Struts2 分割字符串标签s:generator
    (55) 销售锁货功能
    (54) 记录销售单修改详细
    (53) 动态列表自定义
    exe文件作为服务启动
    (52)KeyError错误
    (51) magento集成增加到款通知
    (50)与magento集成
    (49) odoo context操作
  • 原文地址:https://www.cnblogs.com/flyingcr/p/10326858.html
Copyright © 2011-2022 走看看