Input:
NONDUP_REC:
Input:
Input:
UNPIVOT_TABLE Data:
SELECT * FROM
(SELECT *
FROM UNPIVOT_TABLE)
PIVOT (MAX(SALES) FOR QUARTER IN ('Q1' AS Q1,'Q2' AS Q2,'Q3' AS Q3,'Q4' AS Q4));
Input:
Expected Output:
Query:
PIVOT_TABLE Data:
SELECT * FROM
(SELECT *
FROM PIVOT_TABLE)
UNPIVOT(SALES FOR QUARTER IN (Q1, Q2, Q3, Q4));
Scenario 1:
Source Table:
Expected Result:
Using Pivot keyword:
Scenario's:
1. I have an employee table 4 of them are male candidates and 4 of them are female candidates. I need result in such a way that alternatively I have to show male and female employees
Employee Table:
Output:
2. I have Table A (Driving Table) and Table B (Lookup table).I have to pick all the values from Table-A
but if I came across any duplicates when I join with Table-B then I have to pick only one value from Table-B.
For Example:
Table A(Employee):
Table B(Department):
Expected Result:
Query:
select name,department_name from (
select e.name,d.name department_name,row_number() over (partition by rn order by d.name) rn from
(select name,department_id,rownum rn from employee) e left outer join department d on e.department_id = d.department_id)
where rn=1
Output:
Let me take a scenario:
I have implemented SCD 3 type in ODI 12c using Customized knowledge Module. Before using it I want to check it out whether is working as per requirement or not.
Source Data:
Q: You want to ensure that the Physical Mapping Design cannot be modified even if the Logical Design of the Mapping is changed. What sequence of steps must you follow to achieve this
Ans: