0

My program allows the user to select up to 3 suburbs in their local region. The website emails the user about road crashes that occurred in those suburbs. It stores their UserID and the suburbs they selected in table UserSuburbSelections.

My ERD connects 2 actions, selects and stored in:

enter image description here

Am I allowed to do that? Is it good practice?

Christophe
  • 68,716
  • 7
  • 72
  • 138
  • Please ask 1 specific researched non-duplicate question. PS [Why is asking a question on "best practice" a bad thing?](https://meta.stackexchange.com/q/142353/266284) Yes or no questions are seldom useful & seldom what the asker actually wants an answer to. An ERD is an image of DDL. [Why should I not upload images of code/data/?](https://meta.stackoverflow.com/q/285551/3404097) Give just what you need & relate it to your problem. Use images only for what cannot be expressed as text or to augment text. Include a legend/key & explanation with an image. – philipxy May 06 '23 at 05:21
  • What published DB design textbook/reference are you following? What method? What are its steps? Where is the 1st place you are stuck? Why/how are you stuck? You essentially ask us to (re)write a textbook for an unidentified method & bespoke tutorial with no details on what you misunderstand or do or don't understand. [ask] [Help] Basic questions are faqs. [research effort](https://meta.stackoverflow.com/q/261592/3404097) [ask] [Help] ERDs show entities & relationships. "Connecting" has a meaning. Why did you write something when you don't know whether it has meaning? What do you want to say? – philipxy May 06 '23 at 05:36
  • When one inserts an image using the site editor image button it makes a copy in stack.imgur & inserts text to show an image inline with hidden alt text that one types instead of the placeholder alt text. (Not a hyperlink that is text plus URL as you have given.) The alt text is for screen readers & should describe the image content. Unfortunately few posters give it correctly. Here that is the DDL that the ERD illustrates. But the DDL should be in the post body as text. Then alt text should say that the image is an ERD for the DDL. But after DDL is in the body the ERD is essentially redundant. – philipxy May 06 '23 at 06:00
  • In an ERD boxes denote Es & diamonds denote Rs. A R implicitly is an associative E. Everything is "stored in" a table. It is unhelpfully vague to call a R "stored in". Or even to call a R "selected", rather than why. What you describe can be recorded with only entities `User` & `Suburb` & R `[user] inquired re [suburb]` ie `UserSuburbSelections`. In a Chen ERD that's 2 boxes & a diamond. You maybe confuse Chen ERDs with pseudo-ERDs that only show Es (some being associative) & call FKs "relationhips". Also, an ERD does not show actions; it might have Es and/or Rs for actions and/or histories. – philipxy May 06 '23 at 06:40

1 Answers1

-1

Whatever your program performs as actions, in an ERD it's about entities and relations. Here:

  • User or UserDetail is clearly an entity
  • Suburb is an entity as well.
  • The UserSuburbSelection should better be a either a simple relationship between User and Suburb, or an associative entity, if for example the relation should have it's own attributes, such as the order of preference.
  • RoadCrashes would probably a separate entity describing a crash, that would then be related to a suburb.

But your ERD must chose use a notation consistently:

  • Chen's notation, that represents relations with a diamond, and associative entities as a diamond boxed in a rectangle. It is forbidden to relate two relationships directly between them.
  • Crow's foot notation, that represents relationships with a simple line, adorned with some symbols at each end to express multiplicities. Associative entities are represent as an intermediary entity.

Your ERD mixes both notations, making whatever you call "action" a relationship according to Chen, but using Crow's foot cardinality and participation notation between entities and the relationship, which is confusing. Moreover, you've modelled a direct link between two relationships, which is not possible in ERD (unless one if it is an associative entity).

Christophe
  • 68,716
  • 7
  • 72
  • 138