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 do mean by local and global repository?

0 Answers  


How many joins in Informatica

5 Answers   CSC,


What is the fact table?

0 Answers  


how will you remove the duplicate records from flat file without using sorter?

7 Answers  


What can we do to improve the performance of informatica aggregator transformation?

0 Answers  






how the data will be loaded while desiging the schema?which one first (for e.g.-dimesions and facts)

2 Answers   Sonata,


Do joiner transformation use cache? If so describe?

2 Answers   Patni,


What is the meaning of up gradation of repository?

0 Answers  


i have to extract data from a flat file.the flat file has 10 records.i have to extract the 1st and 5th record every time.how is it done.

10 Answers   Emirates, IBM,


How do you remove duplicate records in informatica?

1 Answers  


How do you join more than 3 flat files in informatica?

1 Answers   ITC Infotech,


How do you take care of security using a repository manager

2 Answers  


Categories