This is an interview question.
This is a actual table Employee
:
id | name | salary
1 | A | 7000
2 | B | 6000
3 | C | 5000
4 | D | 5500
5 | E | 4000
6 | F | 4800
7 | G | 3000
8 | H | 2000
And I want a result like this:
id | name | salary
1 | C | 5000
2 | D | 5500
3 | E | 4000
4 | F | 4800
5 | G | 3000
I want to show records whose salary between 5000 to 3000 but 1st column should be sequential.
When I perform query it shows this result.
id | name | salary
3 | C | 5000
4 | D | 5500
5 | E | 4000
6 | F | 4800
7 | G | 3000
[here] what can I write then it will give proper result?
select name, salary, [HERE]
from Employee
where salary between 5000 and 3000;