Pig Latin JOIN (inner) 与JOIN (outer)的区别
1、内连接(自然连接): 只有两个表相匹配的行才能在结果集中出现
2、外连接: 包括
(1)左外连接(左边的表不加限制)
(2)右外连接(右边的表不加限制)
(3)全外连接(左右两表都不加限制)
3. 例子
a.txt
1 2 3
4 2 1
8 3 4
4 3 3
7 2 5
8 4 3
b.txt
2 4
8 9
1 3
2 7
2 9
4 6
4 9
LEFT JOIN
grunt> A = LOAD '/user/mypig/a.txt' AS(a1:chararray,a2:chararray,a3:chararray);
grunt> B= LOAD '/user/mypig/b.txt' AS(b1:chararray,b2:chararray);
grunt> C = JOIN A BY a1,B BY b1;
grunt> DUMP C;
结果:
(1,2,3,1,3)
(4,2,1,4,6)
(4,2,1,4,9)
(4,3,3,4,6)
(4,3,3,4,9)
(8,3,4,8,9)
(8,4,3,8,9)
LEFT OUTER:
grunt> C = JOIN A BY a1 LEFT OUTER,B BY b1;
grunt> DUMP C;
结果:
(1,2,3,1,3)
(4,2,1,4,6)
(4,2,1,4,9)
(4,3,3,4,6)
(4,3,3,4,9)
(7,2,5,,)
(8,3,4,8,9)
(8,4,3,8,9)
版权声明:本文为博主原创文章,未经博主允许不得转载。
Pig Latin JOIN (inner) 与JOIN (outer)的区别的更多相关文章
- SQL中inner join、outer join和cross join的区别
对于SQL中inner join.outer join和cross join的区别简介:现有两张表,Table A 是左边的表.Table B 是右边的表.其各有四条记录,其中有两条记录name是相同 ...
- SQL的inner join、left join、right join、full outer join、union、union all
主题: SQL的inner join.left join.right join.full outer join.union.union all的学习. Table A和Table B表如下所示: 表A ...
- 图解SQL的inner join、left join、right join、full outer join、union、union all的区别
SQL的Join语法有很多,inner join(等值连接) 只返回两个表中联结字段相等的行,left join(左联接) 返回包括左表中的所有记录和右表中联结字段相等的记录,right join(右 ...
- Linq表连接大全(INNER JOIN、LEFT OUTER JOIN、RIGHT OUTER JOIN、FULL OUTER JOIN、CROSS JOIN)
我们知道在SQL中一共有五种JOIN操作:INNER JOIN.LEFT OUTER JOIN.RIGHT OUTER JOIN.FULL OUTER JOIN.CROSS JOIN 1>先创建 ...
- 【转载】SQL中inner join、outer join和cross join的区别
对于SQL中inner join.outer join和cross join的区别很多人不知道,我也是别人问起,才查找资料看了下,跟自己之前的认识差不多, 如果你使用join连表,缺陷的情况下是inn ...
- SQL中inner join,outer join和cross join的区别
使用join连表,缺陷的情况下是inner join,开发中使用的left join和right join属于outer join,outer join还包括full join 现有两张表,Table ...
- 图解SQL inner join、left join、right join、full outer join、union、union all的区别
转于:http://justcoding.iteye.com/blog/2006487 这是一篇来自Coding Horror的文章. SQL的Join语法有很多:有inner的,有outer的,有l ...
- HIVE中join、semi join、outer join
补充说明 left outer join where is not null与left semi join的联系与区别:两者均可实现exists in操作,不同的是,前者允许右表的字段在select或 ...
- SQL夯实基础(一):inner join、outer join和cross join的区别
一.数据构建 先建表,再说话 create database Test use Test create table A ( AID ,) primary key, name ), age int ) ...
- Pig latin基础
pig的两种运行模式,local模式,mapreduce模式 local模式下,pig只能访问本地一台:在mapreduce模式下,pig可以访问一个hadoop集群和hdfs的安装位置.这时,pig ...
随机推荐
- JS中如何获取<Select>中value和text的值
原文地址:JS中如何获取<Select>中value和text的值 html代码: <select id = "city" onchange="chan ...
- 【leetcode刷题笔记】Binary Tree Level Order Traversal(JAVA)
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, ...
- zabbix实现mysql数据库的监控(二)
上章我们把zabbix的服务端和客户端都部署完成了,本章接着进行两部分的设置: 1 添加对mysql数据库主机的监控 2 添加对mysql数据库的监控 一.对数据库服务器主机监控 1 创建主机 步 ...
- Python 3 接口与归一化设计
一.接口与归一化设计: 1.归一化让使用者无需关心对象的类是什么,只需要知道这些对象都具备某些功能就可以了,这极大地降低了使用者的使用难度. 2.归一化使得高层的外部使用者可以不加区分的处理所有接口兼 ...
- [算法]Evaluate Reverse Polish Notation
Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, ...
- HTML入门学习笔记
1.html文件的基本架构 <HTML> <HEAD> <TITLE> 网页的标题 </TITLE> </HEAD> <BODY> ...
- BestCoder Round #4 之 Miaomiao's Geometry(2014/8/10)
最后收到邮件说注意小数的问题!此代码并没有过所有数据,请读者参考算法, 自己再去修改一下吧!注意小数问题! Miaomiao's Geometry Time Limit: 2000/1000 MS ( ...
- cocos2d-x3.0rc打包apk遇到的一些问题记录
下载cocos2d-x3.0rc后根据官方教程进行环境配置等等一系列过程没有遇到什么问题 打包apk时出现一些问题: 按照官方教程cmd下运行cocos run -p android -m relea ...
- C++quickSort
void QuickSort1(int *s,int left,int right){ int i,j,t,pivot; if(left>right) return; if(left<ri ...
- Python基础-内置函数总结
内置函数 int('123') float() string() tuple() set() dict(name='zdd',age=18) type()#查看类型 len()#看长度,其实是元素的个 ...