Question

I have a task to do from the university and I need help. I need to join tables, are two tables employer and departament:

departament(id, description)

employer(id, name, age, dep_id);

I'm using oracle 11, could some friendly person give the way?

Était-ce utile?

La solution

well... I think there is another topic like this, but let's help you.

The way is: you can use inner join...

Taking your example:

select * from employer inner join departament on employer.dep_id = departament.id;

taking the opportunity, I would like to suggest you to study also outer join, left join, right join and of course also inner join.

Autres conseils

Do you need something like this? (the very easiest one)

SELECT * FROM EMPLOYER e, DEPARTAMENT d WHERE e.DEP_ID = d.ID

But I prefer using inner/outer/left/right joins :-)

For explanation see:

What is the difference between Left, Right, Outer and Inner Joins?

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top