I have a database that needs to store customer data which I’m trying to figure out what tables I need. So far I was thinking something like this:
customer table:
- id
- company name
- first name
- surname
- notes
- telephone
- alt telephone
Address table:
- line1
- line2
- town
- post code
site table(physical sites where work needs to be done)
- site name
- notes
A customer will have 1 contact address and 1 + site addresses. the two addresses may be the same (if the customer uses business address as contact). However sometimes the contact address will be different from the site addresses.
Would I need two address tables? one for the customer addresses and one for the site?
also should telephone be a separate table as I will sometimes have 2 stored for each customer?
Your design looks pretty good, though you probably want a id in address, and site as well. I am not sure if you want telephone in your customer table unless you limit the number of numbers that they can have. Does a site need an address (I onlly ask because I am not sure if it is a physical site vs website)? I bring this up because it can effect the design. If the only entity tied to an address is customer, then it would make sense to have a customer_id in address. However, if address is shared between customers, or used in the site table than I would make join tables for it.