Friday, May 27, 2016

Informatica Scenario and SQL Scenario Question

Scenario:
Source data looks like below




 Target 1 (Event number of occurrences)
A has come 2 times in the source, it should go to Target 1



Target 2 (odd number of occurrences)
If source data repeats odd number of times then it should go to Target 2



Solution:
create table test_odd_even_src
(
col1 varchar2(3)
);

create table test_odd_tgt
(
col1 varchar2(3),
col2 int
);
create table test_even_tgt
(
col1 varchar2(3),
col2 int
)
;

insert into test_odd_even_src values('A');
insert into test_odd_even_src values('A');
insert into test_odd_even_src values('B');
insert into test_odd_even_src values('B');
insert into test_odd_even_src values('B');
insert into test_odd_even_src values('C');
insert into test_odd_even_src values('D');


Mapping Looks like this:












Aggregator Transformation:











Joiner:












Router Transformation:












Now try to insert 2 more records into source and run the session again (Before that truncate target tables)
insert into test_odd_even_src values('A');
insert into test_odd_even_src values('B');

Source Data after inserting 2 new records.



select * from test_even_tgt


select * from test_odd_tgt



SQL Scenario:

Source
id,color
a1,yellow
a2,unknown
a1,green
a3,unknown
a1,unknown
a2,blue
Target
id,color
a1,yellow
a1,green
a3,unknown
a2,blue
Data Preparation:
create table test_color_src
(
id varchar2(30),
color varchar2(30)
);

create table test_color_tgt
(
id varchar2(30),
color varchar2(30)
);


insert into test_color_src values('a1','yellow');
insert into test_color_src values('a2','unknown');
insert into test_color_src values('a1','green');
insert into test_color_src values('a3','unknown');
insert into test_color_src values('a1','unknown');
insert into test_color_src values('a2','blue');

Solution:
Source Data:



SQL Query and Its output:

select id,color from test_color_src where color <> 'unknown'
union
(select id,'unknown' from test_color_src where color = 'unknown'
MINUS
select id,'unknown' from test_color_src where color <> 'unknown'
)



Thanks for Reading my blog..!!

19 comments:

  1. Great articles, first of all Thanks for writing such lovely Post! Earlier I thought that posts are the only most important thing on any blog. But here a Shout me loud found how important other elements are for your blog.Keep update more posts..

    Email Marketing Chennai

    ReplyDelete
  2. your blog is really awesome and you have clearly explained many more topics and it is really good thus it is very much interesting and really nice too.

    Best Informatica Training Institute in Chennai

    ReplyDelete
  3. I just see the post i am so happy the post of information's.So I have really enjoyed and reading your blogs for these posts.Any way I’ll be subscribing to your feed and I hope you post again soon.

    digital marketing company in chennai
    seo company in chennai

    ReplyDelete
  4. Your thinking toward the respective issue is awesome also the idea behind the blog is very interesting which would bring a new evolution in respective field. Keep update more information.

    Informatica Training in Chennai

    ReplyDelete
  5. This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic. iOS App Development Company in India

    ReplyDelete
  6. This blog is having the general information. Got a creative work and this is very different one.We have to develop our creativity mind.This blog helps for this. Thank you for this blog. This is very interesting and useful. Security alarm in Chennai

    ReplyDelete

  7. That is very interesting; you are a very skilled blogger. I have shared your website in my social networks..!

    Payday loans in Alabama
    Title loans in South Carolina

    ReplyDelete
  8. Thanks for spending your valuable time in delivering the most valuable content here.I loved the way you write and suggest my friends too for getting aware of your blogs.
    Pawn Shops in Montgomery
    Pawn Shops in Birmingham
    Pawn Shops in Mobile

    ReplyDelete
  9. This idea is mind blowing. I think everyone should know such information like you have described on this post. Thank you for sharing this explanation.Your final conclusion was good. We are sowing seeds and need to be patiently wait till it blossoms.
    Psoriasis Shampoo
    Best Anti Dandruff Shampoo
    Psoriasis Scalp Treatment
    Dandruff Shampoo

    ReplyDelete
  10. This blog is having the good information. Got a creative work and this is very different one.We have to develop our creativity mind.This blog helps for this.Thank you for this blog.This is very interesting and useful.

    Self Employment Tax
    Tax Preparation Services
    Tax Accountant
    Tax Consultant
    Tax Advisor

    ReplyDelete
  11. This comment has been removed by the author.

    ReplyDelete
  12. Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.

    rpa training in bangalore
    best rpa training in bangalore
    RPA training in bangalore
    RPA courses in bangalore

    ReplyDelete
  13. Hmm, it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well as an aspiring blog writer, but I’m still new to the whole thing. Do you have any recommendations for newbie blog writers? I’d appreciate it.
    AWS Training in Bangalore with Placements | AWS Training in Bangalore Cost
    AWS Training in Pune With Placement | AWS Devops Training in Pune
    AWS Online Training | AWS Online Training Cost
    AWS Training in Bangalore cost| Aws training in Bangalore Besant Technologies

    ReplyDelete
  14. Nice post. By reading your blog, i get inspired and this provides some useful information. Thank you for posting this exclusive post for our vision. 
    AWS Training in Bangalore

    ReplyDelete
  15. I think there is a need to look for some more crucial and important aspects of Informatica and SQL.

    Informatica Read JSON

    ReplyDelete