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

which is better perfomancewise lookup or joiner and why?can anyone give example?

6 Answers   TCS,


How to display last 5 records in a table ? With out Top key word and doing order by desc Advance thanks

2 Answers   Puma,


What is informatica etl tool?

0 Answers  


How is Source Side push down optimization different to just providing a SQL override in Source qualifier transformation.

0 Answers  


Describe an informatica powercenter?

0 Answers  






i have flatfile source. i want to load the maximum salary of each deptno into target. what isthe mapping flow

3 Answers   Wipro,


Hi, I am new to Informatica, What is a flat file and how to use flat file in infomratica please help me.

10 Answers   CSC,


when i try to connect to the repository server i am getting this message can someone help me.. Starting Repository [infa_rep] (6016|1292) Informatica Repository Agent, version [7.1.1], build [0811], 32-bit. (6016|1292) Copyright (c) 2000-2004 Informatica Corporation. All Rights Reserved. This Software is protected by U.S. Patent Numbers 6,208,990; 6,044,374; 6,014,670; 6,032,158; 5,794,246; 6,339,775 and other U.S. Patents Pending. (6016|1292) Informatica Repository Agent starting up. (6016|1292) Security audit trail has been turned off. (6016|1292) infa_rep: Repository runtime manager initialized. (6016|1292) infa_rep: Initialized configuration information. (6016|1292) infa_rep: Initialized request dispatcher. (6016|1292) Database Connection Error : Failed to logon to Database server ORA-12154: TNS:could not resolve service name Database driver error... Function Name : Connect Database Error: Failed to connect to database using user [] and connection string []. (6016|1292) Service stopped.

1 Answers  


What is aggregate cache in aggregator transforamtion?

5 Answers  


Can you copy the session to a different folder or repository?

2 Answers  


Stage is which type of load is it a full load or incremental load Please let me know in detail with best example

3 Answers   Infosys,


my source is junk data how will u remove that junk data by using unix please any one replay me

0 Answers   Cap Gemini,


Categories