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...


write sql query following table

city gender no
chennai male 40
chennai female 35
bangalore male 25
bangalore female 25
mumbai female 15

i want the required output

city male female
chennai 40 35
bangalore 25 25
mumbai 15

Answers were Sorted based on User's Feedback



write sql query following table city gender no chennai male 40 chennai female 35 ..

Answer / chanakya

SELECT CITY,
SUM(DECODE(GENDER,'MALE',NO)) MALE ,
SUM(DECODE(GENDER,'FEMALE',NO)) FEMALE
FROM TABLE_NAME GROUP BY CITY

Is This Answer Correct ?    9 Yes 5 No

write sql query following table city gender no chennai male 40 chennai female 35 ..

Answer / venky

select city,sum(c1) male,sum(c2) female from(select
city,decode(gender,'male',no,0)
c1,decode(gender,'female',no,0) c2 from tablename) tablename
group by city;

Is This Answer Correct ?    4 Yes 3 No

write sql query following table city gender no chennai male 40 chennai female 35 ..

Answer / sudheer

Select ABC.CITY AS CITY, sum(ABC.male) as MALE, sum(ABC.Female) as FEMALE from

(
select city, Sum(no) as male, NULL AS female from table_name
where gender = 'male'
Group by city

UNION

select city, NULL as male, SUM(no) AS female from table_name
where gender = 'female'
Group by city

) ABC Group by CITY

Is This Answer Correct ?    0 Yes 0 No

write sql query following table city gender no chennai male 40 chennai female 35 ..

Answer / anshita gupta

select * from city pivot(max(no) for gender in('male ','female'));

Is This Answer Correct ?    0 Yes 0 No

write sql query following table city gender no chennai male 40 chennai female 35 ..

Answer / venu

select* from tablename

Is This Answer Correct ?    1 Yes 5 No

Post New Answer

More Informatica Interview Questions

Dovelopment work (mapings,workflows)and unit testing also done in informatica ,then wt we do ? pls give me detail?

1 Answers  


what is mapping parameter and mapping variables

1 Answers   BirlaSoft,


how we can do session partition in informatica any one explain me clearly? thanks advance.

1 Answers   iGate,


Define informatica repository?

2 Answers   Wipro,


how did u understand business requirement?

2 Answers   TCS,


I want load the data into target with out 1st and last record.

5 Answers   Yash Technologies,


what is shared lookup&persistent lookup?

4 Answers   Accenture, Cap Gemini,


i have one senario i have table with 2columns one for primary key another is a constant value(zero). i have to lookup the table and get the maximum primary key here i don't have any common column between source and lookup table(wt table i explained above)... table is (i am assuming he didn't give the table) column1 column2 5 0 2 0 8 0 6 0 3 0 12 0 7 0

2 Answers   TCS,


how we can add header and footer to flat files?

2 Answers   Tech Mahindra, Zensar,


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

0 Answers  


WAT IS TEXT LOAD?

3 Answers   Wipro,


What is the use of incremental aggregation?

2 Answers  


Categories