Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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 mapping parameter?

2 Answers   Cap Gemini,


What is degenerated dimention table?

7 Answers   Patni,


Design time, run time. If you don't create parameter what will happen

0 Answers  


How do you load more than 1 max sal in each department through informatica or write sql query in oracle?

0 Answers  


What will happen if the select list columns in the custom override sql query and the output ports order in sq transformation do not match?

0 Answers  


hi i want to install latest informatica software in my pc..can anybody help me where should i get the infomatica software..plz help me

3 Answers  


Can we use Lookup instead of Joiner to join 2 tables? If yes which is faster and why?

2 Answers   TCS,


What is the main purpose of Unconnected lookup other than updating slowly changing dimensions? or In which case u use Unconnected lookup?

2 Answers   TCS,


my source is like this id,name sal 10 abc 1000,10 pqr 2000, 10 xyz 3000 ,10 jkl 4000 and my requirement is like this 10 abc,pqr,xyz,jkl 2000 .... i have try for this by using expression transformatin its ok of the concatenation of second column but the thing is that on third column if u group by using agg t/r the last value will com i.e 4000 but i asked by a interviewer that i dont want the first or last column i want the middle column i.e 2000 .plz reply for the same

2 Answers   KPIT,


how lookup transformation is made active in new versions... When to use connected and when to use unconnected lookup and why? which is good for session performance. How to make lookup persistent and how to remove stale data from that lookup. how commit works - when we stop or abort data. Explain in both cases. What is factless fact table and have you ever used it in real time scenarios.

0 Answers   CTS,


If the records doesnt satisfy the filter condition where will it go?

10 Answers   IBM,


i have different sources in different databases ,that sources may be 100 tables i want to load these tables in to single target how to pearform the task

14 Answers   Altisource, TCS,


Categories