Ebay Interview Question for Software Engineer / Developers






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

the following is the perfect query ....

select
(select Sum(sal) from emp group by sal having sal=(select Max(sal)from emp)) -
(select Sum(sal) from emp group by sal having sal=(select Min(sal)from emp))
from dual;

- gullu October 15, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Why do we need group by, how about

select
(select Sum(sal) from emp where sal=(select Max(sal)from emp)) -
(select Sum(sal) from emp where sal=(select Min(sal)from emp))
from dual;

- Anonymous July 16, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

nice !!!!!

- Arun Kumar Gupta August 24, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

select sum(sal) keep (dense_rank first order by sal asc) over (partition by dept) total_min_sal, sum(sal) keep (dense_rank last order by sal asc ) over (partition by dept)  total_max_sal,emp.* from emp

- jk September 19, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

select sum(sal) keep (dense_rank first order by sal asc) over (partition by dept) total_min_sal, sum(sal) keep (dense_rank last order by sal asc ) over (partition by dept) total_max_sal,emp.* from emp

- jk September 19, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

select max(s) - min(s) from ((select count(*)*value as s from salary group by (value) ) as t1)

- Anonymous September 24, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

select m1 - m2 from (select sum(salary) as m1 from Surbhi where salary = (select max(salary)from Surbhi)) as t1,(select sum(salary)as m2 from Surbhi where salary = (select min(salary)from Surbhi)) as t2;

- Anonymous October 15, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

select sum(salary)-(select sum(salary) from test where salary in (select min(salary) from test)) from test where salary in (select max(salary) from test);


The code works.. just tested it

- Vidya October 15, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

select sum(salary)-(select sum(salary) from test where salary in (select min(salary) from test)) from test where salary in (select max(salary) from test);


The code works.. just tested it.

- Vidya October 15, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Thanks gullu!!!

- Richa Aggarwal November 19, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

select e.salary, count(*), sum(e.salary)
from employee e
inner join
(select max(salary) max, min(salary) min from employee) t
where e.salary in (t.max, t.min)
group by e.salary

- ypliu November 24, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

select (select sum(salary) from employee where salary = (select max(salary) from employee)
- select sum(salary) from employee where salary = (select min(salary) from employee)) from dual;

- Kevin March 09, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

select sum(a.salary) - sum(b.salary) from emp a, emp b
where a.salary = (select max(salary) from emp)
and b.salary = (select min(salary) from emp);

- Anonymous August 05, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

select max(salary*count )-min(salary*count ) from( select salary, count(*) as count from employee group by salary)

- Anonymous August 23, 2010 | 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