Consider a Phone Log table as below. It records all phone numbers that we dial in a given day.




SOURCE_PHONE_NUMBER
DESTINATION_PHONE_NUMBER
CALL_START_DATETIME
1234
4567
01/07/2011 10:00
1234
2345
01/07/2011 11:00
1234
3456
01/07/2011 12:00
1234
3456
01/07/2011 13:00
1234
4567
01/07/2011 15:00
1222
7890
01/07/2011 10:00
1222
7680
01/07/2011 12:00
1222
2345
01/07/2011 13:00




Please provide an SQL query to display the source_phone_number and a flag where the flag needs to be set to Y if first called number and last called number are the same and N if the first called number and last called number are different.




Desired Output:




Source Number
Is_Match
1222
N
1234
Y

Answers were Sorted based on User's Feedback



Consider a Phone Log table as below. It records all phone numbers that we dial in a given day. ..

Answer / jd

this can be done using FIRST_VALUE() AND LAST_VALUE()

check the below link for more information

http://netezzamigration.blogspot.com/2014/10/lastvalue-and-firstvalue-best-example.html

Is This Answer Correct ?    2 Yes 1 No

Consider a Phone Log table as below. It records all phone numbers that we dial in a given day. ..

Answer / kivi

first value and last value...

for more info ref 

http://etltechsolutions.wordpress.com/2014/10/12/last_value-and-first_value-best-example/

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More Informatica Interview Questions

How can the following be achieved in 1 single Informatica Mapping. * If the Header table record has error value(NULL) then those records and the corresponding child records in the SUBHEAD and DETAIL tables should also not be loaded into the target(TARGET1,TARGET 2 or TARGET3). * If the HEADER table record is valid, but the SUBHEAD or DETAIL table record has an error value (NULL) then the no data should be loaded into the target TARGET1,TARGET 2 or TARGET3. * If the HEADER table record is valid and the SUBHEAD or DETAIL table record also has valid records only then the data should be loaded into the target TARGET1,TARGET 2 and TARGET3. =================================================== HEADER COL1 COL2 COL3 COL5 COL6 1 ABC NULL NULL CITY1 2 XYZ 456 TUBE CITY2 3 GTD 564 PIN CITY3 SUBHEAD COL1 COL2 COL3 COL5 COL6 1 1001 VAL3 748 543 1 1002 VAL4 33 22 1 1003 VAL6 23 11 2 2001 AAP1 334 443 2 2002 AAP2 44 22 3 3001 RAD2 NULL 33 3 3002 RAD3 NULL 234 3 3003 RAD4 83 31 DETAIL COL1 COL2 COL3 COL5 COL6 1 D001 TXX2 748 543 1 D002 TXX3 33 22 1 D003 TXX4 23 11 2 D001 PXX2 56 224 2 D002 PXX3 666 332 ======================================================== TARGET1 2 XYZ 456 TUBE CITY2 TARGET2 2 2001 AAP1 334 443 2 2002 AAP2 44 22 TARGET3 2 D001 PXX2 56 224 2 D002 PXX3 666 332

3 Answers   IBM, Mphasis,


What is a surrogate key?Why we use it in a mapping?Pl give an example.

4 Answers   PCS,


Explain in detail scd type 2 through mapping.

0 Answers  


How can we remove the duplicates from flat file source?

0 Answers  


what is parameter file?

1 Answers   Cap Gemini,






What is a router transformation?

0 Answers  


How to load the data from people soft hrm to people soft erm using informatica?

0 Answers  


suppose in my source flatfile i have 10000 records in that some of master table records missed table records missed then what will u do

0 Answers   Patni,


How to recover the standalone session?

2 Answers  


how do u use sequence created in oracle in informatica? Explain with an simple example

6 Answers   CTS,


How to jion 2 tables, without using any condition?

11 Answers   Amazon,


i have ten flat files with same structure,if i want to load it to single target,and mapping needs to should show only one source.what will be the steps to taken to achieve it?/

5 Answers   L&T,


Categories