Connecting Tech Pros Worldwide Help | Site Map

Question about DB normalisation

  #1  
Old June 18th, 2009, 09:07 AM
mikek12004's Avatar
Familiar Sight
 
Join Date: Sep 2008
Location: Athens, Greece
Posts: 181
I have a table for categories (id->the primary key, and name) and I want to add another column parent (one category might be inside another) with the id's range of values so in fact parent will be a foreign key of the id right?Can I declare a foreign key of a primary key in the same table as that primary key or it is better make a seperate table for the relationships between categories? (lately been reading about db normalisation and wandering which the right thing to do)
PS any good tutorials on DB normalisation ?
  #2  
Old June 30th, 2009, 11:42 AM
Member
 
Join Date: Dec 2007
Posts: 47

re: Question about DB normalisation


I got the most from these tutorials.

http://www.keithjbrown.co.uk/vworks/mysql/mysql_p7.php

But normalisation has to be one of the hardest things involved in designing a website. Especially with around 10-20 tables and hundreds of columns. I just dont seem to be able to learn it. ;p just read it over and over and it sort of gets a little clearer but never clear. Good luck.
  #3  
Old July 4th, 2009, 01:33 AM
Member
 
Join Date: Aug 2007
Posts: 119

re: Question about DB normalisation


No, you can't create a foreign key in its own table. To be foreign, it must be the primary key in another table. This is why you call it foreign. Otherwise I think you would have to call it a "native" key. ;-)
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
autofill form vibee answers 14 July 17th, 2007 01:09 AM
Auto Number mysql S.Dickson@shos.co.uk answers 13 November 17th, 2006 06:45 AM
rdf vs. databases reviswami78@yahoo.com answers 1 August 29th, 2006 05:45 PM
Normalisation Question perhaps? Mark Reed answers 3 November 13th, 2005 01:50 AM