title: Associative table many on many with varying level of entity specificity
body: <p>I have the need to associate a message or a group of messages with a display or a group of displays.</p>
  
  <p>A message has a type, and a display has a type and a location ( for example, a city)</p>
  
  <p>I would like to associate a message or all messages of a certain type to a display or all display of a certain type and/or location.</p>
  
  <p>My first idea was to build an associative table many on many, with the foreign keys:</p>
  
  <ul>
  <li>Message_id</li>
  <li>Message_type_id</li>
  <li>Display_id</li>
  <li>Display_location_id</li>
  <li>Display_type_id</li>
  </ul>
  
  <p>And when adding an entry, set a value for the fields i am interested in ( for example message_type and display_location), and null to the others.</p>
  
  <p>However, i was interested in the downsides of this approach, and wondering if there are better methods to handle this kind of problems. After some days searching (in vain) for this kind of pattern when designing a database, i ultimately decided to ask here.</p>
  
  <p>Thanks for the help.</p>