wtite sql query following table are
city gender no
chennai male 40
chennai female 35
bangalore male 10
bangalore female 25
mumbai female 15
i want the output?

city male female
chennai 40 35
bangalore 10 25
mumbai null 15

Answers were Sorted based on User's Feedback



wtite sql query following table are city gender no chennai male 40 chennai female ..

Answer / santosh kumar sarangi

select city,max(decode(gender,'male',no)) as male,
max(decode(gender,'female',no)) as female from table_name
group by city

Is This Answer Correct ?    1 Yes 0 No

wtite sql query following table are city gender no chennai male 40 chennai female ..

Answer / gagan

Suppose first table as test created below create table test
(
city varchar2(50),
gender varchar2(50),
nmbr varchar2(50)
)

and keep all data in it as mentioned and then try to run
this query...


select a.city, a.nmbr as male, b.nmbr as female
from test a, test b
where a.gender = 'male' and b.gender = 'female' and b.city
= a.city

Is This Answer Correct ?    2 Yes 2 No

wtite sql query following table are city gender no chennai male 40 chennai female ..

Answer / gagan

Suppose first table as test created below...

create table test
(
city varchar2(50),
gender varchar2(50),
nmbr varchar2(50)
)

and keep all data in it as mentioned and then try to run
this query...


select a.city, a.nmbr as male, b.nmbr as female
from test a, test b
where a.gender = 'male' and b.gender = 'female' and b.city
= a.city

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Informatica Interview Questions

What is powercenter on grid?

0 Answers  


Q. source having mutile depatment of data, dept1, dept2 ....dept10 today. we have mutilple depts in source, we need to generate dept1, dept2 and multile files in target side. today we have 10 dept which have 10 files, tommorow we have only 4 dept and 4 files, dayafter tommorow we have only 6 all the number of files in the targete file directory it's always dynamic. how can acheive it.

0 Answers  


Suppose we do not group by on any ports of the aggregator what will be the output?

0 Answers  


How the Informatica Server reads perameter file?

1 Answers  


how can u load the data in time dimension?

3 Answers  






What are the designer tools for creating tranformations?

1 Answers   Informatica,


For stage table data processing, suppose in first run we processed 8 records out of 10 records then in 2nd run we should consider only not processed records (here total no of records =2) along with new records which got loaded in stage table thru real time mapping. Note : In this example, 8 records are those records for which we got transaction number after lookup on trn_no_cod table and 2 records for which lookup returns trn_no as NULL

1 Answers  


How to extract original records at one target & Duplicate records at one target? {with out using EXPRESION transformation and sequence generator transformation?}<-this is important

4 Answers   CTS,


explain abt union t/r?

1 Answers   IBM,


In a sequential batch can you run the session if previous session fails?

4 Answers  


Hi experts ,I have a Source of 1000 records.I have to load 100 records in first target,101 to 200 records in 2nd target, 201 to 300 records in 3rd target and again 301 to 400 in first target like that as cyclick process. How can i acheive this.

5 Answers   DELL, TCS,


Can yoU use the maping parameters or variables created in one maping into another maping?

2 Answers  


Categories