ETL Testing Interview Questions
ETL Testing Interview Questions
Interview Questions
1.Get the output using Inner Join, Left Outer Join, Right Outer Join,
Full Outer Join?
Table-1 Table-2
ID ID
1 1
2 2
1 4
2 0
3 NULL
0 NULL
NULL
NULL
Inner Join: This join select all rows of both the tables as long as condition
satisfied.
ID ID_1
1 1
2 2
1 1
2 2
0 0
Left Outer Join: This join returns all the rows of the table on the left side and
mathes rows of the table on the right side.
ID ID
1 1
2 2
1 1
2 2
0 0
Null null
Null null
3 null
Right Outer Join: This join returns all the rows of the table on the right side and
mathes rows of the table on the left side.
ETL Testing
Interview Questions
ID ID
1 1
2 2
1 1
2 2
0 0
Null null
Null null
Null 4
Full Outer Join: This join returns all the rows of both LEFT and RIGHT tables.
ID ID
1 1
2 2
1 1
2 2
0 0
Null null
Null null
Null 4
3 null
Null null
Null null
10.Write the sql query to fetch department wise nth lowest salary?
ETL Testing
Interview Questions
select * from (select employee_id,department_id,salary,dense_rank()
over(partition by department_id order by salary asc) as derank from
employees) where derank=1;
11.Write down the SQL query to get second maximum and maximum
salary from employee table?
Select max(salary) from employees;
select max(salary) from employees where salary not in(select max(salary) from
employees);
12.Fetch the employees more than 1 year experience?
Select employee_id, first_name, salary ,hire_date,(extract(year from sysdate)-
extract(year from hire_date)) as exp from employees where extract(year from
sysdate)-extract(year from hire_date)>1;
13.Fetch the dept name which is not having single employee?
select department_id,department_name from departments d where
department_id not in(select distinct nvl(department_id,0) from employees );
14. What is the difference between RANK() VS DENSE_RANK() VS
ROW_NUMBER()?
RANK(): Rank will assign the same number for the row which contains the same
value and skips next number.
Dense_rank(): dense_rank() will assign the same number for the row which
contains the same value and with out skipping the next number.
Row_number(): row_number() will generate a unique number for every
row ,even if one or more rows has the same value.
15.write down the query to find the greatest value from below
columns?
Year Q1 Q2 Q3 Q4
2019 100 200 300 400
2020 600 100 200 300
2021 100 700 200 NULL
Select employee_id,(case
when first_name is not null and middle_name is not null and last_name is not
null then first_name||’_’||middle_name||’_’||last_name
when first_name is null and middle_name is null and last_name is not null
then last_name
when first_name is null and middle_name is not null and last_name is not null
then middle_name||’_’||last_name
when first_name is not null and middle_name is not null and last_name is null
then first_name||’_’|| middle_name
when first_name is not null and middle_name is null and last_name is null
then first_name
when first_name is not null and middle_name is not null and last_name is null
then first_name||’_’||last_name
when first_name is null and middle_name not null and last_name is null
then middle_name
else “null”
ETL Testing
Interview Questions
end as fullname from employee;
31.Write down the SQL Query for fetching manager details who is
having more than 10 subordinates?