-4

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?

  • You can refer to this article [Explanation of SQL Joins](http://blog.codinghorror.com/a-visual-explanation-of-sql-joins/) – rs. May 13 '14 at 21:54
  • 1
    You need to ask a more specific question, there are many ways to join tables. Please explain what you're trying to accomplish, show some sample data, and the desired results. Then show what you've tried, since we're not here to do your homework for you. We'll help you fix it so you can learn from your mistakes. – Barmar May 13 '14 at 21:54

2 Answers2

1

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?

Community
  • 1
  • 1
Swag
  • 1,998
  • 9
  • 30
  • 61
1

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.

romulos
  • 270
  • 2
  • 9
  • good one, worked properly.Thanks for your suggestion, I I will study it. thank you – user3634367 May 13 '14 at 22:00
  • 1
    You're welcome, well, as was said by Barman above on the comments, there are another ways to join tables, check your task again and see if it will solve your problem, otherwise try to provide to us further informations. – romulos May 13 '14 at 22:03
  • Ok romulos I got this, thanks a lot man. – user3634367 May 13 '14 at 22:05
  • There are thousands of topics like this. – Qix - MONICA WAS MISTREATED May 13 '14 at 22:42
  • so why are you losing your precious time? Is my first week using database, could have a lot of question like my one. You know a lot but I don't so I would like that you respect my act. – user3634367 May 13 '14 at 23:00
  • @user3634367, what folks are trying to say is: you're expected to research here (and Google) and show your efforts to solve the problem by yourself ***when*** posting a question at [so]. The site is quite simple to use and totally worth it, please check the sections **Asking** and **Our model** in the [help]. Good luck! – brasofilo May 13 '14 at 23:57
  • Is important to explain to him, how stackoverflow works, but is also his first time here, look his profile... so I think is enough for this discussion. – romulos May 14 '14 at 00:11