PDA

View Full Version : Any Oracle geniuses about?



kingzl3y
12-15-2009, 02:20 PM
I know it's probably in the wrong section, move if necessary!
I've had a pretty tough few months, uni is finally coming to an end and I'm my last assignment; oracle.
Basically had to create a company from scratch, plan, design and implement in Oracle. I've hardly ever used Oracle but it's actually quite simple.

I took a lot of time off, been battling depression and now the time has come to hand in work It's kind of hit me even harder because I didn't attend some lessons. (Although class mates are in more dire than me?)

I'll cut to the chase, I've got a about 15 tables all related in someway or another.
The pretty much last question is KILLING me, I have to create a query to show staff listing for a user enter branch number showing the line manager for each member of staff.
For this I've gotta get information from 3 tables, Employee, Branch and Line_manager.

Is there any way I can do a 3 way join?

Something like this?


select branch_id, branch.branch_address, employee_id, employee_name, role.role_name, line_manager.line_manager_id from (employee INNER JOIN role on
employee.role_id = role.role_id, inner join branch on employee.branch_id=branch.branch_id, inner join line_manager on employee.line_manager_id=line_manager.line_manager _id);


(I know the above is wrong and unfortunately I do not have Oracle at my computer (only available at campus :mad:))

Can anyone shed a bit of light into the matter? Just a point in the general direction will do perfectly!

all the best,
kingsley

big poppa pump
12-16-2009, 08:19 AM
Quick question. List the variables you have in your original tables and the fields that need to be there in the new table after the join.

ahmad
12-16-2009, 11:41 AM
What's wrong with:



SELECT employee.branch_id,
employee.employee_id,
employee.employee_name,
employee.line_manager_id,
branch.branch_address,
role.role_name,
FROM employee, branch, role
WHERE employee.role_id = role.role_id
AND employee.branch_id = branch.branch_id;


I removed the line_manager table cause it seems useless..


I know it's probably in the wrong section, move if necessary!
I've had a pretty tough few months, uni is finally coming to an end and I'm my last assignment; oracle.
Basically had to create a company from scratch, plan, design and implement in Oracle. I've hardly ever used Oracle but it's actually quite simple.

I took a lot of time off, been battling depression and now the time has come to hand in work It's kind of hit me even harder because I didn't attend some lessons. (Although class mates are in more dire than me?)

I'll cut to the chase, I've got a about 15 tables all related in someway or another.
The pretty much last question is KILLING me, I have to create a query to show staff listing for a user enter branch number showing the line manager for each member of staff.
For this I've gotta get information from 3 tables, Employee, Branch and Line_manager.

Is there any way I can do a 3 way join?

Something like this?



(I know the above is wrong and unfortunately I do not have Oracle at my computer (only available at campus :mad:))

Can anyone shed a bit of light into the matter? Just a point in the general direction will do perfectly!

all the best,
kingsley