write sql query following table

quarter sales
q1 1000
q1 2000
q1 3000
q1 4000
q2 5000
q2 6000
q2 7000
q2 8000
q3 1000
q3 2000
q3 3000
q3 4000
q4 5000
q4 6000
q4 7000
q4 8000
i want the output format like
q1 q2 q3 q4
1000 5000 1000 5000
2000 6000 2000 6000
3000 7000 3000 7000
4000 8000 4000 8000

Answers were Sorted based on User's Feedback



write sql query following table quarter sales q1 1000 q1 2000 q1 3000 q1 ..

Answer / parthu

It may possible with Normalizer transformation.

Is This Answer Correct ?    1 Yes 0 No

write sql query following table quarter sales q1 1000 q1 2000 q1 3000 q1 ..

Answer / letc

Using max function for q1,q2,q3,q4 in Aggregator transformation. Use sorter before aggregator

Is This Answer Correct ?    2 Yes 2 No

write sql query following table quarter sales q1 1000 q1 2000 q1 3000 q1 ..

Answer / jj

without one more column its not possible i thing , it shoud
have prod or some thing

select prod,sum(q1),sum(q2),sum(q3),sum(q4) from (
select prod,(case when quarter='q1' then sal end) q1
,(case when quarter='q2' then sal end) q2
,(case when quarter='q3' then sal end) q3
,(case when quarter='q4' then sal end) q4 from za)
group by prod

Is This Answer Correct ?    1 Yes 1 No

write sql query following table quarter sales q1 1000 q1 2000 q1 3000 q1 ..

Answer / ankit kansal

one solution can be like this


select max(q1) as q1,max(q2) as q2,max(q3) as q3,max(q4) as q4 from
(
select case when quarter = 'q1' then sales end q1
,case when quarter = 'q2' then sales end q2
,case when quarter = 'q3' then sales end q3
,case when quarter = 'q4' then sales end q4
,row_number() over ( partition by quarter order by 1 ) rnk

from sequel_test order by 5

)tb group by rnk order by 1,2,3,4

Is This Answer Correct ?    1 Yes 1 No

write sql query following table quarter sales q1 1000 q1 2000 q1 3000 q1 ..

Answer / chandu

In Expression transfermation, if( sales = q1,sales,0)

Is This Answer Correct ?    1 Yes 13 No

Post New Answer

More Informatica Interview Questions

Hi, I want to change date type char value integer value? I tried alter table tab_name modify (newcolumn newdatetype). But The columns have 10 million values(char type) so I want to load now numeric data. How it is possible? Old Values New Value(I want to load numeric data but the old value should be there in the column) Y 1 N 0 ERROR at line 1: ORA-01439: column to be modified must be empty to change datatype Please help on this. Thanks, GM

1 Answers   IBM,


Can you please mail me a copy of Informatica Certification Exam dumps to sriveniv@hotmail.com

0 Answers  


Hi i am new to Informatica. I have few question's in Informatica. Can any one respond, it will be appricaited. Q.Is Flat File Contains the Dynamic Cache?

6 Answers  


Why we use stored procedure transformation?

4 Answers  


How do you convert single row from source into three rows into target?

0 Answers  






How do you load alternate records into different tables through mapping flow?

0 Answers  


How to load last n records of file into target table - informatica

0 Answers   Informatica,


What is a surrogate key?

0 Answers  


How to display session logs based upon particular dates. If I want to display session logs for 1 week from a particular date how can I do it without using unix.

1 Answers   DELL,


Hi all , I am planning for informatica S - PowerCenter 8 Mapping Design certification. I have rewuired the dumps for the same. if anyone of you having the same pl. share it with me. This will be of great help. My contact is : sagardev7@gmail.com TIA , Sagar

0 Answers  


Explain in detail about scd type 1 through mapping.

0 Answers  


How to load the data into target table, which not have Primary/Surrogate key (Duplicate records not acceptable)

5 Answers   TCS,


Categories