Hello friends,
I m a newbie to SQL and came across the following queries, quite tough for me, woking hard on it. Could u pass on the solutions (if u have them ???) and the explanation for the same ??? Glad if u could, Thanx in advance.
Write SQL queries for the following :
------------------------------------
1. Give the range of missing Empno :
Table Emp :
Empno
1
5
9
12
19
The expected output is supposed to be :
2-4
6-8
10-11
13-18
* Assume the data is not sorted
[Hint : Self join ]
2. Write a Delete statement to delete Duplicate records
[Hint : Self join or SubQuery ]
3. Table Bank :
Dr Cr
5000 3000
6000 2000
5000 4000
Display should be as follows :
Balance (Dr - Cr)
-------
2000
6000
7000
The output should be as Cumulative Balance.
4. Display the OVERALL 5th largest Salary from the emp table
[Hint : a subquery or selfjoin ]
5. Display the maximum and the second maximum salary from Emp table
First Second
----- ------
10000 9000
I m a newbie to SQL and came across the following queries, quite tough for me, woking hard on it. Could u pass on the solutions (if u have them ???) and the explanation for the same ??? Glad if u could, Thanx in advance.
Write SQL queries for the following :
------------------------------------
1. Give the range of missing Empno :
Table Emp :
Empno
1
5
9
12
19
The expected output is supposed to be :
2-4
6-8
10-11
13-18
* Assume the data is not sorted
[Hint : Self join ]
2. Write a Delete statement to delete Duplicate records
[Hint : Self join or SubQuery ]
3. Table Bank :
Dr Cr
5000 3000
6000 2000
5000 4000
Display should be as follows :
Balance (Dr - Cr)
-------
2000
6000
7000
The output should be as Cumulative Balance.
4. Display the OVERALL 5th largest Salary from the emp table
[Hint : a subquery or selfjoin ]
5. Display the maximum and the second maximum salary from Emp table
First Second
----- ------
10000 9000