Deloitte Consulting LLP Interview Question for Applications Developers


Country: India
Interview Type: In-Person




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

There's various ways to find the second highest salary, such as:

SELECT MAX(salary) from employee WHERE salary NOT IN (SELECT MAX(salary) from employee );

SELECT MAX(salary) from employee WHERE salary < (SELECT MAX(salary) from employee)

SELECT salary from where employee a where 2 = (SELECT COUNT(DISTINCT salary) from employee b
where a.salary<=b.salary )

select TOP 1 salary from (select TOP 2 salary from employee order by salary DESC ) As ownTable order by salary ASC;

- Arpita Gupta September 15, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I am using oracle HR database having tablename employees:

select distinct salary from hr.employees e1 where 2= (select count(distinct salary) from he.employees e2 where e1.salary<=e2.salary );

- akansha July 19, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

using SQL Server

WITH CTE AS
(
SELECT Name, Salary, DENSE_RANK() OVER (PARTITION BY Salary ORDER BY SALARY DESC) AS Ranks
FROM Employees
)
SELECT * FROM CTE WHERE Ranks=2

- Sushant Aggarwal July 19, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

SELECT MAX(Salary)
FROM Employees
WHERE Salary <> (SELECT MAX(Salary) FROM Employees)

- PK July 19, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

WITH CTE AS
(
SELECT Name, Salary, DENSE_RANK() OVER (Salary ORDER BY SALARY DESC) AS Ranks
FROM Employees
)
SELECT * FROM CTE WHERE Ranks=2

- Sameera Jonnalagadda September 10, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

select max(salary) from employee where salary < select max(salary) from employee;

- itsmeashishsingh November 17, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

with cte as
(
select name, Salary, dense_rank() over(order by salary desc) as ranks from emp
)
select * from emp where rank = 2

- Anil February 12, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Select name, Salary from
(
select name, Salary, dense_rank() over(order by salary desc) as ranks from emp
)A where ranks=2

- krishna July 05, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

select * from emp a where 2 = (select count(distinct (b.salary)) from emp b where b.salary >= a.salary);

- sriharsha.vemuri31 August 24, 2019 | 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