I am designing a Dataware house for the Stackoverflow job section. I have two dimensions: job opportunity and company. every record of job opportunity is referenced to only one record of company dimension. there are two ways to implement this relationship.

first: design1 second: enter image description here

I doubt which approach is better. can anyone help?

  • 1
    First. With unique coinstraint on job_opportunity.company_id. – Akina Dec 20 '19 at 13:50
  • @Akina why unique constraint is needed? I only need to mention it is a foreign key. a company can have multiple job opportunity. – Fatemeh Karimi Dec 20 '19 at 14:01
  • why unique constraint is needed? You tell one and only one - without this constraint one may insert one more record into job_opportunity referenced to the same record in company. – Akina Dec 20 '19 at 14:03
  • @Akina sorry it was my mistake. I fixed it – Fatemeh Karimi Dec 20 '19 at 14:15
  • 1
    If so you do not need in UNIQUE constrain. Relation will be 1:N, intermediate table is excess except the link is an entity itself. – Akina Dec 20 '19 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.