title: Tags class with comma separated values or separated tables?
body: <p>I need to add a tags system to one of my websites.</p>
  
  <p>Right now i am coding something lke this:</p>
  
  <p>tags_table</p>
  
  <pre>CREATE TABLE `tags_table` (
  `id` int(15) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `seo_url` varchar(50) NOT NULL,
  PRIMARY KEY (`id`)</pre>
  
  <p>files_table have "tags" field [varchar(250)]</p>
  
  <p>When i add new tags:<br /></p>
  
  <ul>
  <li>i list all tags from tags_table and select the ones i want<br /></li>
  <li>i save the tag names to files_table.tags -> comma separated values<br /></li>
  </ul>
  
  <p>That way is easier to show the file tags.</p>
  
  <p>When i edit the file:
  - select/unselect the tags and save again.</p>
  
  <p>Method II with different tables:</p>
  
  <ul>
  <li>i know that i can make separated table like tags_files and put tag_id and file_id</li>
  </ul>
  
  <p>But when i edit the file how i check what tags were added or removed for that file?</p>
  
  <p>What is more efficient? </p>
  
  <p>Comma separated values in a field or different tables?</p>
  
  <p>Also, when i edit a tag name or delete a tag the changes should be made on all files too.</p>