josephbupe Posted September 26, 2014 Share Posted September 26, 2014 Hi,I am re-visiting my database table relationship for criminal incidents.Six tables are involved plus a junction table to make it seven tables in total.I need someone to review this relationship and advise whether or not it is correctly set up.The relationships are as follows:1. A person can belong to more than one incident:t_persons (one-to-many) t)_incidents_persons2. A person can only have one nationality by birtht_persons (one-to-one) t_countries3. An agency can have more than one incidentt_agencies (one-to-many) t_incidents4. A status (e.g. closed incident) can belong to more than one incidentt_status (one-to-many_ t_incidents5. A keyword (i.e. offence type eg theft)t_offencekeywords (one-to-many) t_incidents Quote Link to comment https://forums.phpfreaks.com/topic/291293-database-tables-relationship/ Share on other sites More sharing options...
josephbupe Posted September 26, 2014 Author Share Posted September 26, 2014 Sorry here is the screenshort of the EER diagram. Regards. Joseph Quote Link to comment https://forums.phpfreaks.com/topic/291293-database-tables-relationship/#findComment-1492129 Share on other sites More sharing options...
Barand Posted September 26, 2014 Share Posted September 26, 2014 First, a comment or three on your current model. Person table contains the country_id twice. Person table should not contain the country currency and currency code fields. They should only be in the country table. Country-person is a one-to-many relationship, not on-to-one (one country has many persons) Notes on my model (I only included the key fields for brevity): An incident will have several statuses over its lifetime. I included from and to dates so that historical data is available (how many open cases were there each month, for instance) The "to_date" field in the current status record would contain 9999-12-31. This enables you find the current status as the one where the current date is between the two dates in the record. Is it possible that one agency is in charge of an incident but later an other agency takes control? If so you may need to take that same approach with the agency-incident relationship. Incidents may require several keywords. For example, take the "Jack the Ripper" murders in 19th century London. Several incidents all with keywords "Murder, mutilation, prostitute" Quote Link to comment https://forums.phpfreaks.com/topic/291293-database-tables-relationship/#findComment-1492162 Share on other sites More sharing options...
josephbupe Posted October 7, 2014 Author Share Posted October 7, 2014 That's what I needed. Quote Link to comment https://forums.phpfreaks.com/topic/291293-database-tables-relationship/#findComment-1492936 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.