Database design -relation among entities -


i have:

  • request has id pk , other attributes.

  • customer database id pk , other attributes

  • visitor entity , phone number can pk.


  • customer , visitor can make request.
  • i need record whom make request
  • the customer id has different format phone number.
  • i add fk called requestid inside visitor table , make pk visitor identified request.
  • but problem how connect customer request?
  • my suggested solutions:
  • add fk inside customer table ---> can not change database
  • creating new table , copy customer info , adding new column --> contains redundancy.
  • create new table contains requestid , customerid ---> relation not many-to-many make in separate table(customer can make many request , request made 1 customer) , don't no if god practices.
  • add fk inside request table identified whom make request ---> problem domain not same.

kindly see image entities , tell me best way connect customer? enter image description here

thanks in advance,

if customer can make many requests, , request can belong 1 customer, need foreign key in request reference customer.

if customer can associated many visitors, visitor should have foreign key customer. you'd think of visitor join table make customer requests.


Comments