title: MySQL Database Design with tags across multiple tables
body: <p>I am working on some web apps which should all use the same user table. The different applications all need different table designs, so I created one table for each app, with the UserID being a foreign key referring to the user table.</p>
  
  <p>Now I want to add tags to all apps. The tags should be in one table for every app in order to easily query all tags from one user(for searching purposes, the search should be able to find everything tagged with that tag, no matter the app). Personally, I don't think splitting them up into multiple tables would be a good idea, but I am not that into database design so I might be wrong. My current attempt looks something like this:</p>
  
  <p>[tags]</p>
  
  <pre><code>EntryID | UserID | Tag
  </code></pre>
  
  <p>The thing is that the EntryIDs of course would have to be unique across all app tables with this solution. For the notes app I need something like this:</p>
  
  <p>[notes]</p>
  
  <pre><code>EntryID | UserID | title | content | etc.
  </code></pre>
  
  <p>For my calendar I have the following table:</p>
  
  <p>[calendar]</p>
  
  <pre><code>EntryID | UserID | name | start | end | etc.
  </code></pre>
  
  <p>Now I don't know how to manage those EntryIDs. Should I create another table like this</p>
  
  <p>[entries]</p>
  
  <pre><code>EntryID | UserID | type
  </code></pre>
  
  <p>with type being something like "note" or "calendar", and EntryID being the primary key? And should the type be something like an integer, or a string, or is there a possibility to kind of refer to another table in the type column? And should I then make the EntryIDs in the app tables into foreign keys referring to the entries table?</p>
  
  <p>I put the userID in every table because I think this is going to speed up querying, for example when I need every tag one user has set across all apps. I know normalization usually prohibits this, but I again think that it would very much increase query speed and reduce load for both the MySQL server and my back-end.</p>
  
  <p>I would appreciate every tip for structuring this, and thanks in advance!</p>