Jump to content

Recommended Posts

Hi.

 

I have this ERR (it is bigger but for the problem is irrelevant).

The users can be company's or single users (persons).

In the job_offers i have two foreign keys, so i used them as PK.

 

sql.jpg

 

It has any problem with this model? the relation between users and company is identified? at the moment the tables are represented as identified.

thanks

Link to comment
https://forums.phpfreaks.com/topic/235852-there-is-any-problem-with-this-design/
Share on other sites

What I see here is a user can have zero to one relationships with a company, so a company can only have one user? If this is true, why bother with user_id in job_offer since by selecting the company, you have selected the user_id

 

Normally I would expect to see a one to many relationship from company to user, just as you have a one to many relationship between job offers and company.

 

Just wondering

thanks.

 

The relation between users and company is only 0 or 1 because the company with username "Nokia" only can have an year of foundation and a unique description for example. The data of two tables- users and company is related and can't be shared with another company's. Anyway, the table users is shared with single users and company users

 

Then there is no reason to link job offer to anything other than company, is there? Or can a company be in the list more than once, and the user permits uniqueness? If so, you need to have a separate table for company, and an intersect table between user and company which then can be connected to jobs.

 

 

if i have an identified relation, i must use in job_offers two foreign keys, one related to company and other to the users (id_company and id_users in job_offers)

The only alternative is change to a non identified relationship

 

But i think the relation between users and company and company to job_offers  are a clear Identified relationship.

And interesting question  perhaps, if a user can only belong to a single company, and a company can only have a single user, why not put user information inside the company table? Unless you have another table which user is connected to directly, but then again, it seems everything is related through company

 

fair warning, I am a real geek on this stuff since I did database design for more than two decades.  :)

the users can be company users or single users, single users can be students or workers, a worker  can work for a company that is not user in the system. A student can expect to work in a company xxx that is not user in the system. The database is a bit complex.

 

 

Got it, so if the job_offering is linked to a user/company pair, and the relationship between the user and company drops, what happens? It seems perhaps that you are assuming that the relationship between a user and company will last as long as the job offering - always. Is that so?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.