felito Posted May 8, 2011 Share Posted May 8, 2011 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. 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 Quote Link to comment https://forums.phpfreaks.com/topic/235852-there-is-any-problem-with-this-design/ Share on other sites More sharing options...
crtreedude Posted May 8, 2011 Share Posted May 8, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/235852-there-is-any-problem-with-this-design/#findComment-1212377 Share on other sites More sharing options...
felito Posted May 8, 2011 Author Share Posted May 8, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/235852-there-is-any-problem-with-this-design/#findComment-1212379 Share on other sites More sharing options...
crtreedude Posted May 8, 2011 Share Posted May 8, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/235852-there-is-any-problem-with-this-design/#findComment-1212380 Share on other sites More sharing options...
felito Posted May 8, 2011 Author Share Posted May 8, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/235852-there-is-any-problem-with-this-design/#findComment-1212385 Share on other sites More sharing options...
crtreedude Posted May 8, 2011 Share Posted May 8, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/235852-there-is-any-problem-with-this-design/#findComment-1212389 Share on other sites More sharing options...
felito Posted May 8, 2011 Author Share Posted May 8, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/235852-there-is-any-problem-with-this-design/#findComment-1212392 Share on other sites More sharing options...
crtreedude Posted May 8, 2011 Share Posted May 8, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/235852-there-is-any-problem-with-this-design/#findComment-1212414 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.