Trouble with foreign keys
In my ER diagram, I have a big table called "EVENT" that roughly looks like this:
EVENT_ID: INTEGER
USER_ID: USER
EVENT_TYPE: VARCHAR
SCREEN_ID: SCREEN
BUTTON_ID: BUTTON
TIMESTAMP: DATETIME
The USER table contains user data, the BUTTON table contains the name and the location on screen of the button. Event types are things like viewing a screen or clicking a button.
There are various categories of screens. One of them is called "Lessons", which contains more "Exams", each "Exam" containing more questions. So my SCREEN table (1:1 relationship with itself) looks like this:
SCREEN_ID: INTEGER
SCREEN_TYPE: VARCHAR
TIME_ON_SCREEN: INTEGER
SCREEN_URL: VARCHAR
PREVIOUS_SCREEN_ID: VARCHAR
PREVIOUS_SCREEN_URL: VARCHAR
There is a 1:M relationship between SCREEN and LESSON, a 1:M relationship between LESSON and EXAM, and a 1:M relationship from EXAM to QUESTION.
**The problem is, a single question contains more screens because first it shows the question and after I answer an explanation follows. So even if the question ID is the same, the screen ID changes.** How do I represent this relationship in the diagram and what happens to the SCREEN_ID key? Will it become a foreign key in QUESTION?
Subject
Written By
Posted
Trouble with foreign keys
May 04, 2021 05:17AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.