1
$\begingroup$

I am making database on Disaster Management. There are four tables.

  1. DisasterEvent (eventid, name, glideID, status, description, date_occurred, date_ended, disaster_type)

  2. People(eventid, num_deaths, num_injuries, num_affected)

  3. Homes (eventid, num_homes_destroyed, num_homes_damaged, total_insured_loss, total_uninsured_loss)

  4. Place (place_id, city, state, country, postal_code)

In my design, I have one to one relationship between People and DisasterEvent , and one to one relationship between Home and DisasterEvent because for a particular disaster there is only one People table that we are concerned and same for Home table. Now, Place has many to many relationship with DisasterEvent because at particular place there can be many disasters over time and same disaster could occur many place at once.

What am I trying to achieve is able to map number of affected people by the particular disaster event at certain place. For this I think there needs to be three way relationship among DisasterEvent, Place and People. How do I achieve this?

$\endgroup$
1
  • 3
    $\begingroup$ The title you have chosen is not well suited to representing your question. Please take some time to improve it; we have collected some advice here. Thank you! $\endgroup$
    – Raphael
    Commented Apr 4, 2016 at 7:39

1 Answer 1

4
$\begingroup$

Since you have a 1-1 relationship between DisasterEvent and People now, you can not distinguish any relation between People and Place. If several Places are related to a single DisasterEvent, all those places are related to the same instance of People.

If you want to map the People affected by the Event at a Place, you should relate People to Place instead of to DisasterEvent.

As long as an event always occurs at at least one place, you can always relate your People to your DisasterEvent via the Place where it occurred.

On a sidenote, I would use Location instead of Place, and maybe the more precise Victims for People, as well as maybe Damage for Home.

$\endgroup$
2
  • $\begingroup$ Thank you. I see the problem now. What kind of relation do you think people will have with place. Is it going to be one to many or one to one? $\endgroup$ Commented Apr 4, 2016 at 5:49
  • 1
    $\begingroup$ I think you'd have one set of victims (people) at each location (place), so a one-to-one. Since you have a many-to-many relation between event and place, the relation with people would technically be one to one between people and (disasterevent-place). $\endgroup$
    – oerkelens
    Commented Apr 4, 2016 at 6:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.