Interview Question for Data Engineers


Country: United States
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
1
of 1 vote

using window function:
select employee, salary, lead(salary) over(partition by department order by salary) as next_salary, department
	from table
using scalar-subquery:
select employee, salary, (select min(salary) from table t2 where t2.department=t1.department and t2.salary>t1.salary) as next_salary, department
	from table t1

- N October 13, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

SELECT Employee,Salary,
LEAD(salary,1) OVER (PARTITION BY Department ORDER BY Department) AS Next_Sal
Department
FROM Employee
GROUP BY 1,2,4
ORDER BY Employee

- Anonymous November 20, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

SELECT Employee,Salary,
       LEAD(salary,1) OVER (PARTITION BY Department ORDER BY Department) AS Next_Salary
       Department
FROM `amazoninterviewquestions.Business_Intelligence.Rough_Work` 
GROUP BY 1,2,4
ORDER BY Employee

- Vinit Rajguru November 20, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

SELECT Employee,Salary,
       LEAD(salary,1) OVER (PARTITION BY Department ORDER BY Department) AS Next_Salary
       Department
FROM `amazoninterviewquestions.Business_Intelligence.Rough_Work` 
GROUP BY 1,2,4
ORDER BY Employee

- analystkumar01 November 20, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

select
e1.first_name,
e1.salary,
(select e2.salary from employees e2
where d.id=e2.department_id
and e2.salary > e1.salary
order by e2.salary
limit 1) as "next_salary",
d.name
from employees e1
join departments d on d.id=e1.department_id

- rahuls January 25, 2021 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

SELECT
Employee
,Salary
,LEAD(Salary,1) OVER (PARTITON BY Department ORDER BY Department) AS Next_Salary
,Department
FROM table
GROUP BY 1,2,3
ORDER BY Employee

- Anonymous February 26, 2021 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

SELECT
Employee
,Salary
,LEAD(Salary,1) OVER ( PARTITION BY Department ORDER BY Department) AS Next_highest_salary
,Department
FROM source_table
GROUP BY 1,2,4
ORDER BY Employee

- Jadzia February 26, 2021 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Create a table for employee with fields I'd,name, department,salary, address and display data records in tables formate

- Anonymous March 17, 2021 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More