-1

I am currently designing a prototype for a small Content Management System. A user can create a new page, and then add different elements to the page. For example, a title, a paragraph, a video and maybe another paragraph. I currently have the following, but I don't know if this is valid. Also, I have no idea which table to search when I need to get the data.

Current EER design

So my questions summarized:

  1. The column cmsElementId refers to all three tables on the right, but in the end, it should only point to one.
  2. If this is valid, how would I get to know which table to select my data from.
  3. If this is invalid, can you point me in a better direction?
Jacob Kapitein
  • 245
  • 1
  • 4
  • 14
  • https://stackoverflow.com/questions/4050784/defining-multiple-foreign-keys-in-one-table-to-many-tables/4051523#4051523 – Damir Sudarevic Apr 09 '20 at 09:48
  • That's not really the answer I'm looking for. That post is about 4 tables referring to 1 general table, but in my case it's the other way around. 1 table contains 4 different tables. – Jacob Kapitein Apr 09 '20 at 11:49
  • Please [use text, not images/links, for text--including tables & ERDs](https://meta.stackoverflow.com/q/285551/3404097). Use images only for what cannot be expressed as text or to augment text. Include a legend/key & explanation with an image. – philipxy Apr 10 '20 at 00:37
  • It's unclear what you need because you only give a diagram that doesn't make sense since it abuses FKs. Please clarify. Then this will be a faq. Before considering posting please read the manual & google any error message or many clear, concise & precise phrasings of your question/problem/goal, with & without your particular strings/names & site:stackoverflow.com & tags; read many answers. If you post a question, use one phrasing as title. Reflect your research. See [ask] & the voting arrow mouseover texts. 2/many FKs [sic] to 2/many tables is an anti-pattern for DB/SQL subtyping/inheritance. – philipxy Apr 10 '20 at 00:41

1 Answers1

0

I have fixed the issue. I have been thinking way too difficult, even though the solution is right in front of my nose.

Simple solution

I just made the 4 separate tables refer to the page. This way one page can have multiple elements. It's even just as expandable as I intended. I just need to fix a few issues like the order in which elements will be displayed, but that's a different story.

Jacob Kapitein
  • 245
  • 1
  • 4
  • 14