• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DB design help

#1
Hi,

I am building a web project for a leasing company.
Leasing company's customer can be both a person or a company.
if customer is a company then it has Authorized representers (can be more than one representer) which.

I can't find a proper DB table structure to meet this needs.

Any help is appreciated...
Thanks
Reply

#2
You could have a customer table that has nullable user_id and [b]company_id[/id] columns. Fill in the one that's relevant and leave the other blank and build logic out from there.
Support Development  • Practical CodeIgniter 3  • Vulcan - CLI Tools for CI4
Reply

#3
I would create a users table and companies table. That gives you the flexibility of handling multiple users per company if that ever arises.
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply

#4
(06-07-2019, 07:18 AM)kilishan Wrote: You could have a customer table that has nullable user_id and [b]company_id[/id] columns. Fill in the one that's relevant and leave the other blank and build logic out from there.

Thank you for you advice. This is the solution I came up with, but was not sure about it. Now you confirmed it, I can go on with it.
thanks Smile
Reply

#5
this might help. our customers are a mixture of companies and people. A company usually has more than one contact. Our customer table is a list of names with a linked list of contacts each with a statusID of mainContact, accountsContact or otherContact. The statusID is very useful because in many companies, the people who order are not those who handle payments so monthly statements go automatically to the email of the accountsContact. You might find it odd but the address field is in the contacts table alongside the name, email, phone, mobile fields because some companies have multiple delivery addresses. when the mainContact is updated, it updates the corresponding entry in the customers table
Bill
Reply

#6
Here are a couple of web sites that may be of help.

Database Answers - Database Models

MySQL Sample Databases
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.