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

Answer Posted / anshita gupta

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

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

whats the logic to load the lower level of granularity of data to fact table.

1807


Hi, I want to change date type char value integer value? I tried alter table tab_name modify (newcolumn newdatetype). But The columns have 10 million values(char type) so I want to load now numeric data. How it is possible? Old Values New Value(I want to load numeric data but the old value should be there in the column) Y 1 N 0 ERROR at line 1: ORA-01439: column to be modified must be empty to change datatype Please help on this. Thanks, GM

3454


What are the measure objects?

664


What are the types of schemas we have in data warehouse.

533


When do you use sql override in a lookup transformation?

590






If i have source as flat file. how can i store the header and trilor into one target and data into one more target. |------>target1(header+trailor) source------ |------>target2(data) can any one please help me

1559


What is target load order?

808


Hi, I saw one mapping implemented by my seniors . In Expression transformation they implemented following logic. That is iif(is_date(in_UC_DATINV,'YYYYMMDD'),to_date(in_UC_DATINV,'Y YYYMMDD'),'Inventory Date is either invalid or null') Inventory_Date is validated only for is_date() But not validated for notisnull() . But error says “ either invalid or null “ why? Whether is_date() also check for not isnull() ? or in this logic something is different ? Please answer me . Advance thanks

1416


Define mapping and session?

587


Performance tuning in UNIX for informatica mappings?

2146


What is the fact table?

593


How would you join a node to the already existing domain?

683


how to create user defined function (udf) in informatica

787


Which transformation should we use to normalise the COBOL and relational sources?

748


Explain the different kinds of facts.

566