Pergunta

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?

Foi útil?

Solução

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.

Outras dicas

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?

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top