Normalizer Related
Questions
Q3. Suppose in our Source
Table we have data as given below:
Student Name
|
Maths
|
Life Science
|
Physical Science
|
Sam
|
100
|
70
|
80
|
John
|
75
|
100
|
85
|
Tom
|
80
|
100
|
85
|
We want to load our Target Table as:
Student Name
|
Subject Name
|
Marks
|
Sam
|
Maths
|
100
|
Sam
|
Life Science
|
70
|
Sam
|
Physical Science
|
80
|
John
|
Maths
|
75
|
John
|
Life Science
|
100
|
John
|
Physical Science
|
85
|
Tom
|
Maths
|
80
|
Tom
|
Life Science
|
100
|
Tom
|
Physical Science
|
85
|
Describe your approach.
Ans. Here to convert the
Rows to Columns we have to use the Normalizer Transformation followed by
an Expression Transformation to Decode the column taken into consideration. For
more details on how the mapping is performed please visit Working with
Normalizer
Q5. Suppose we have a
source table and we want to load three target tables based on source rows such
that first row moves to first target table, secord row in second target table,
third row in third target table, fourth row again in first target table so on
and so forth. Describe your approach.
Ans. We can clearly
understand that we need a Router transformation to route or filter
source data to the three target tables. Now the question is what will be the
filter conditions. First of all we need an Expression Transformation
where we have all the source table columns and along with that we have another
i/o port say seq_num, which is gets sequence numbers for each source row from
the port NextVal of a Sequence Generator start value 0 and increment
by 1. Now the filter condition for the three router groups will be:
§
MOD(SEQ_NUM,3)=1 connected to 1st target
table
§
MOD(SEQ_NUM,3)=2 connected to 2nd target
table
§
MOD(SEQ_NUM,3)=0 connected to 3rd target
table
Q8. Suppose in our Source
Table we have data as given below:
Student Name
|
Subject Name
|
Marks
|
Sam
|
Maths
|
100
|
Tom
|
Maths
|
80
|
Sam
|
Physical Science
|
80
|
John
|
Maths
|
75
|
Sam
|
Life Science
|
70
|
John
|
Life Science
|
100
|
John
|
Physical Science
|
85
|
Tom
|
Life Science
|
100
|
Tom
|
Physical Science
|
85
|
We want to load our Target Table as:
Student Name
|
Maths
|
Life Science
|
Physical Science
|
Sam
|
100
|
70
|
80
|
John
|
75
|
100
|
85
|
Tom
|
80
|
100
|
85
|
Describe your approach.
Ans. Here our scenario is
to convert many rows to one rows, and the transformation which will help us to
achieve this is Aggregator.
No comments:
Post a Comment