Jump to content

Best way to do this database design


Recommended Posts

Hello. In my business logic, I have a user, a company (users can be part of the company) and products. 

A product can be owned by a user or by a company, the company can assign it to a user later, but it would still be owned by the company (in case the company fires the user). 

My thought is to have the user table, the company table and the product table. 

I'm thinking about having a product_owner table, where I would have product_id, user_id, company_id, agent_assigned. 

If the product is owned by a user then only product_id and user_id will be filled. If it's owned by a company, then product_id, company_id and agent_assigned would be filled. 

Is this the best way to do it? It doesn't seem good to me.

Link to comment
Share on other sites

  • 4 weeks later...
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.

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.