title: How do foreign keys work in this possible M:M relationship?
body: <p>In my ER diagram, I have a big table called &quot;EVENT&quot; that roughly looks like this:</p>
  <pre><code>EVENT_ID: INTEGER
  
  USER_ID: USER
  
  EVENT_TYPE: VARCHAR
  
  SCREEN_ID: SCREEN
  
  BUTTON_ID: BUTTON
  
  TIMESTAMP: DATETIME
  </code></pre>
  <p>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.</p>
  <p>There are various categories of screens. One of them is called &quot;Lessons&quot;, which contains more &quot;Exams&quot;, each &quot;Exam&quot; containing more questions. So my SCREEN table (1:1 relationship with itself) looks like this:</p>
  <pre><code>SCREEN_ID: INTEGER
  
  SCREEN_TYPE: VARCHAR
  
  TIME_ON_SCREEN: INTEGER
  
  SCREEN_URL: VARCHAR
  
  PREVIOUS_SCREEN_ID: VARCHAR
  
  PREVIOUS_SCREEN_URL: VARCHAR
  </code></pre>
  <p>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.</p>
  <p><strong>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.</strong> 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?</p>