Raja_KT
Engineer
Engineer
  • UID6384
  • Fans0
  • Follows0
  • Posts114
Reads:256Replies:0

[Others]Map reduce or SQL :)

Created#
More Posted time:Dec 6, 2018 22:51 PM
Map reduce or SQL :)


Note: This could have been run with  partition by a field, using windows analytical function but it is just sample :)



create table map1(id1 integer);
insert into map1 values(3);
insert into map1 values(1);
insert into map1 values(2);


select id1,count(id1) from map1 group by id1


create table map2(id1 integer);


delete from map2
insert into map2 values(2);
insert into map2 values(1);
insert into map2 values(2);


select id1,count(id1) from map2 group by id1




create table map3(id1 integer);


insert into map3 values(1);
insert into map3 values(1);
insert into map3 values(1);


select id1,count(id1) from map3 group by id1


select id1,sum(cn1) from ( select id1,count(id1) as cn1 from map1 group by id1  union all select id1,count(id1) as cn1 from map2 group by id1  union all select id1,count(id1) as cn1 from map3 group by id1 ) group by id1






Street children suffer not because of their fault. We can help them if we want.Contact me.
Guest