Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Some Challenging but difficult query for me !! Help

Status
Not open for further replies.

sagarsaw

Programmer
Apr 5, 2001
1
IN
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
 
You left out your class name and instructor... Malcolm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top