<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1039242" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1039242</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-normalization#comment-1223146</link>
    <description> &lt;p&gt;so then how do i track how many times a file has been downloaded?  do i make a new table that stores the download_id along with download_count?  why would it be so bad just to leave download_count with the download table?&lt;/p&gt;
 </description>
     <pubDate>Thu, 16 Aug 2007 06:02:40 +0000</pubDate>
 <dc:creator>sublimer</dc:creator>
 <guid isPermaLink="false">comment 1223146 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-normalization#comment-1222904</link>
    <description> &lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;sublimer wrote:&lt;/strong&gt; download_count is a measure of how many times the file has been downloaded, it&#039;s not an ID.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Yes I realised that. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
&lt;p&gt;It&#039;s superfluous though, the &lt;em&gt;download&lt;/em&gt; table is describing two things: downloads and files, which is incorrect.&lt;/p&gt;
 </description>
     <pubDate>Thu, 09 Aug 2007 19:34:00 +0000</pubDate>
 <dc:creator>JeevesBond</dc:creator>
 <guid isPermaLink="false">comment 1222904 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-normalization#comment-1222902</link>
    <description> &lt;p&gt;Thank you very much JeevesBond.  download_count is a measure of how many times the file has been downloaded, it&#039;s not an ID.&lt;/p&gt;
 </description>
     <pubDate>Thu, 09 Aug 2007 15:16:02 +0000</pubDate>
 <dc:creator>sublimer</dc:creator>
 <guid isPermaLink="false">comment 1222902 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-normalization#comment-1222793</link>
    <description> &lt;p&gt;Sublimer:  About the genres... yes.&lt;/p&gt;
 </description>
     <pubDate>Tue, 07 Aug 2007 20:31:22 +0000</pubDate>
 <dc:creator>brady.k</dc:creator>
 <guid isPermaLink="false">comment 1222793 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-normalization#comment-1222792</link>
    <description> &lt;p&gt;That diagram violates first and second normal forms. &lt;em&gt;artist&lt;/em&gt; violates the first and &lt;em&gt;downloads&lt;/em&gt; the second. Something like the attached might be more in order.&lt;/p&gt;
&lt;p&gt;To be in first normal form all values must be atomic. Meaning no repeating groups like artist_genre1, artist_genre2, artist_genre3. So in the diagram I&#039;ve split the table to form a many-to-many relationship, think of it like this: one genre has many many artists, whilst one artist has many genres. You could constrain it to one genre by removing the linker &lt;em&gt;artist_genre&lt;/em&gt; table. &lt;/p&gt;
&lt;p&gt;To be in second normal form all values must be dependent on the primary key. This means a table must describe one thing and one thing only: in the downloads table you&#039;re lumping information about available files in with the downloads, this means attributes like filename, filesize etc. are not dependent upon the primary key (download_id). A good clue to this is the attribute: &lt;em&gt;download_count&lt;/em&gt;, if there&#039;s to be one row for each download how are you to include a download_count? How does this describe the download?&lt;/p&gt;
&lt;p&gt;&lt;em&gt;download_count&lt;/em&gt; is actually superfluous, since the information can be found by aggregating download and file information. Something like: [incode]SELECT COUNT(*) FROM download INNER JOIN file ON download.file_id=file.file_id WHERE file_name=&#039;test.mp3&#039;[/incode].&lt;/p&gt;
&lt;p&gt;*** EDIT ***&lt;br /&gt;
I had no idea what &lt;em&gt;boot&lt;/em&gt; is so have guessed where it should go. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Tue, 07 Aug 2007 20:15:57 +0000</pubDate>
 <dc:creator>JeevesBond</dc:creator>
 <guid isPermaLink="false">comment 1222792 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-normalization#comment-1222732</link>
    <description> &lt;p&gt;So, you lets say I have a good 30 different genres, just make a table with the current artist table info, drop artist_genre1, 2 and 3, and then add 30 different columns with the names of the genres?&lt;/p&gt;
&lt;p&gt;I will be using PHP to make my queries.  The &quot;this boot contains 15 tracks&quot; was just something I used as a filler, it could be anything.  I intend it to be a paragraph or so about the album.  It would include things like where it was recorded, special guests on the album, like a bio of the album.&lt;/p&gt;
&lt;p&gt;Once I get the table set up, I will create some indexes and all too.  I really want to get this database done right.&lt;/p&gt;
 </description>
     <pubDate>Mon, 06 Aug 2007 13:31:59 +0000</pubDate>
 <dc:creator>sublimer</dc:creator>
 <guid isPermaLink="false">comment 1222732 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-normalization#comment-1222721</link>
    <description> &lt;p&gt;At a glance, it looks pretty good.  You have the general right idea... id&#039;s and primary key&#039;s are your friend.  They let you easily cross reference between tables.&lt;/p&gt;
&lt;p&gt;As for your redundancy question... something I would do would be to possibly not have &quot;artist_genre1&quot;, &quot;artist_genre2&quot;, etc... but rather have a field for EACH genre.&lt;/p&gt;
&lt;p&gt;So an artist entry would have the fields (in addition to what you have already):&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;rb&lt;br /&gt;rock&lt;br /&gt;metal&lt;br /&gt;jazz&lt;br /&gt;classical&lt;br /&gt;rap&lt;br /&gt;hip-hop&lt;br /&gt;funk&lt;br /&gt;spoken&lt;br /&gt;...etc&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;What would you do with that?  Those would all be booleans, basically:  an int(1) type.  1 = genre is true for that artist, 0 = not.&lt;/p&gt;
&lt;p&gt;So... for someone like... Metallica, you might have&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;metal = 1&lt;br /&gt;rock = 1&lt;br /&gt;neoclassical = 1&lt;br /&gt;heavy = 1&lt;br /&gt;jazz = 0&lt;br /&gt;funk = 0&lt;br /&gt;... etc&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;This allows you to easily query the database...&lt;/p&gt;
&lt;p&gt;Looking for metal artists?&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;quot;SELECT * FROM artists WHERE metal = 1&amp;quot;&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;Looking for an artist that is funk, jazz, and metal combined?&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;#039;SELECT * FROM artists WHERE metal = 1, jazz = 1, funk = 1&amp;quot;&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;Does that help?  I think I was pretty clear.&lt;/p&gt;
&lt;p&gt;Are you going to be using PHP to run the queries?  Or something else?&lt;/p&gt;
&lt;p&gt;A suggestion I would have would be to absolutely decide on a db/table structure before implementing anything...  I&#039;ve learned that the hard way.&lt;/p&gt;
&lt;p&gt;A final suggestion would be to keep the entries to the bare minimum possible...  so instead of having &quot;boot_info&quot; say &quot;this boot contains 15 tracks&quot;... create a &quot;boot_tracks&quot; field and then just insert &quot;15&quot;... and use whatever language you&#039;re in to display the text differently.  This would be across the board... keep the data either simple numbers, or simple phrases (besides things like names and titles), it will make your life easier.&lt;/p&gt;
 </description>
     <pubDate>Mon, 06 Aug 2007 06:55:12 +0000</pubDate>
 <dc:creator>brady.k</dc:creator>
 <guid isPermaLink="false">comment 1222721 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
