informatica n sql interviewscenarios
Post on 05-May-2017
221 Views
Preview:
TRANSCRIPT
Senior Level (Can be asked part of SQL or ETL Design)
1. A customer is having multiple devices, depends on their usage the devices are ranked in “DeviceSeq” column, As an output business want to see top3 devices which are applicable against a user in a single row. Refer the tables below for INPUT and OUTPUT.
InPut
Customer ID DeviceSeq
Device Name
C1 1 iPhone 4S
C1 2 Android
C1 3 HTC
C2 1 iPhone
C2 2 iPod Touch
Output ========
CustomerID DeviceType1 DeviceType2 DeviceType3
C1 iPhone 4S Android HTC
C2 iPhone iPod Touch
2. Write SQL to Reverse the order of Column Y and print along with the other columns
Source Table
X Y Z
1 10 100
2 20 200
3 30 300
4 40 400
Expected Output
X Y Z
1 40 100
2 30 200
3 20 300
4 10 400
3. Due to wrong files FTP’d and lack of validation in ETL process Duplicate records got inserted into a table. To carry on with the Validation Write a SQL to display duplicate Records out of the below table
ID MONTH SAL
1 JAN 100
2 JAN 120
3 FEB 120
4 FEB 100
5 MAR 200
6 APR 150
ID MONTH SAL
1 JAN 100
2 JAN 120
3 FEB 120
4 FEB 100
4. Produce the below output from the given input.
INPUT
City Store Address
Chennai T Nagar
Chennai Anna Nagar
Chennai KK Nagar
Bangalore M.G.Road
Bangalore Whitefield
OUTPUT
City Store
Chennai T Nagar,Anna Nagar,KK Nagar
Bangalore M.G.Road,Whitefield
Advanced SQL 5. How to achieve below scenario through select statement in oracle.
Table Name Sales
ORDER_NUM ORDER_TYPE TRANSACTION_DATE YEAR_MONTH AMOUNT (Rs) 10001 SO 11/15/2008 2008-11 1000
10002 SO 10/11/2008 2008-10 10000
10003 SO 10/11/2008 2008-10 5000
10004 SO 9/11/2008 2008-09 25000
10005 SO 9/10/2008 2008-09 3000
10006 SO 8/17/2008 2008-08 45000
10007 SO 8/16/2008 2008-08 2000
10008 SO 7/17/2008 2008-07 5000
10009 SO 7/16/2008 2008-07 3000
10010 SO 7/16/2008 2008-07 7000
10011 SO 7/16/2008 2008-07 9000
10012 SO 7/16/2008 2008-07 10000
Expected output :
Monthwise & As of Date 'Sales Order Amount'
YEAR_MONTH Total_Order Order Amount ( Month) Order Amount ( As of Date)
2008-07 5 34000 34000
2008-08 2 47000 81000
2008-09 2 28000 109000
2008-10 2 15000 124000
2008-11 1 1000 125000
AS of Date : Sum of Previous Month + Current Month ( 34000 + 47000 = 81000) for 2008 - 08
Informatica
1. How can we implement self-join using joiner transformation - Can i directly take 2 input pip;lines from same source qualifier and link it to the Joiner transformation. Answer:- You cannot join Pipelines from same Source Qualifier you need to Instances of the Source. 2. When i am using update strategy to update the target if i am not using data driven option @ session level what will happen Answer:- It will insert records 3. When i have partitioned Source how informatica improves the performance.
Answer:- If a session has multiple partitions Informatica creates a separate database connection for
each partition.
5. Difference between Joiner and Lookup
Non Equi Join is not supported in Joiner where in Lookup supports non Equi Join.
Using Joiner we can perform all type of outer Joins and Inner Joins where when we have lookup
it just simulates Left outer Join
If we doubt candidate is theoretical we can give the below scenario
Consider I am having EMP and SALARY file as below by passing the SAL column value to the SALARY File I have to pick GRADE and Populate it in target This can be solved using Lookup, not with Joiner since joiner supports only “=” operator
EMP
EMPNO DEPTNO SAL
E1 10 2000
E2 10 3000
E3 20 4000
SALARY
SAL_START SAL_END GRADE
0 1000 Low
1001 3000 Medium
3001 5000 High
6. How can we implement Cartesian product (Cross Join) using Joiner (Basically joining 2 sources
without any condition)
Before joiner add Expression transformation against each source and create dummy ports assign same value then use that port to do join. 7. Consider that in product file I am having Product Name, Brand Name,Size,Category, I want to
load this data into 3 different targets using Single pipeline
when Brand Name = B1 then load it to first Target when Brand Name = B2 then load it to Second Target Load all the data from source to the Third Target. Answer :- They have to use Router and 3 group needs to be created for third group they can use either “true”/”1=1”,they cannot use Default group will filter the other 2 brands. If they say they will link third target directly from source then Informatica reds source twice which is inefficient design.
top related