Sunday, May 22, 2011

Suppose in our Source Table we have data as given below:

Suppose in our Source Table we have data as given below:
Student NameSubject NameMarks
SamMaths100
TomMaths80
SamPhysical Science80
JohnMaths75
SamLife Science70
JohnLife Science100
JohnPhysical Science85
TomLife Science100
TomPhysical Science85


We want to load our Target Table as:
Student NameMathsLife SciencePhysical Science
Sam1007080
John7510085
Tom8010085
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 .Our Mapping will look like this:
Info_interview17
Mapping using sorter and Aggregator


We will sort the source data based on STUDENT_NAME ascending followed by SUBJECT ascending.
Info_interview18
Sorter Transformation


Now based on STUDENT_NAME in GROUP BY clause the following output subject columns are populated as
MATHS: MAX(MARKS, SUBJECT='Maths')
LIFE_SC: MAX(MARKS, SUBJECT='Life Science')
PHY_SC: MAX(MARKS, SUBJECT='Physical Science')
Info_interview19
Aggregator Transformation

No comments:

Post a Comment