This week's book giveaways are in the iOS and Features new in Java 8 forums.
We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and Relational Databases and the fly likes Another SQL problem... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Another SQL problem..." Watch "Another SQL problem..." New topic

Another SQL problem...

Amy Phillips
Ranch Hand

Joined: Apr 02, 2003
Posts: 280
I have an instructor table where each instructor has a unique ins_id, there is also a mentor_id column which allows instructors to mentor other instructors. This is show by having the ins_id of the mentoring instructor in the mentor_id column
sort of like:
ins_ID Mentor_ID
1 -
2 -
3 2
4 2
5 3
The problem is I need to show the average number of instructors per mentor but am a bit lost on how to do this.
I am guessing something like counting the number of occurences each instructor has in the mentor field and dividing it?
If anyone has any ideas I would be very grateful
David Peterson
Ranch Hand

Joined: Oct 14, 2001
Posts: 154
Did you manage to get the previous problem sorted out?
Is this homework for a course?
Amy Phillips
Ranch Hand

Joined: Apr 02, 2003
Posts: 280
Yes the other solution worked a treat - thanks.
These are forming part of a database system so not exactly homework.
Amy Phillips
Ranch Hand

Joined: Apr 02, 2003
Posts: 280
Its ok, I have finally worked out the solution - it turned out to be much more simple than I was trying to make it
I agree. Here's the link:
subject: Another SQL problem...