I am just learning some PHP, and MySQL use. After reading several tutorial, I decided I would like to create a data base of links for my website's links page.
I came up with these catagories I would need to describe a link:
link_url, link_text(used as alt text for images,or just as text for link),link comment (further comments about link),link alignment(right,left,center),link catagory, and catagory comment.
Following the normiliztion article:http://phpbuilder.com/columns/barry20000731.php3
I applied the first step:
First Normal Form
Eliminate repeating groups in individual tables.
Create a separate table for each set of related data.
Identify each set of related data with a primary key.
I came up with two tables:
link id,link_url,link_text,link_image,link comment,link_align,
catagory id, catagory, catagory comment
Second Normal Form
Create separate tables for sets of values that apply to multiple records.
Relate these tables with a foreign key.
A link may have multiple text or images or comments
so I seperated the link_url into a table
Table 1link discriptions) (link_id,link_text,link_img,link_comment,link_align
Table 2unique link url)
url(unique primary key),rellink_id(foreign key)
Table 3:cat_id,cat,cat comment
now I wonder when, how, and where do I relate the catagory to the link?
just conitinuing to step 3
Third Normal Form
Eliminate fields that do not depend on the key. I think this step is done because table 1 the link_id is based on either the text image comment or a combination of the above
this is where I give up and just wing it
table 2: add a relationship for the cat
url(primary key),relcat_id(foreign key one to one?)
change the relationship between table 1 discription and table 2:
table 1: link discription
link_id(primary key),rel_url(foreign key),link_text,link_image,link_comment
ahh crap though I'm hoplessly lost in normiliztion, I think the above schem would work anyone one to suggest how this is done properly?
I came up with these catagories I would need to describe a link:
link_url, link_text(used as alt text for images,or just as text for link),link comment (further comments about link),link alignment(right,left,center),link catagory, and catagory comment.
Following the normiliztion article:http://phpbuilder.com/columns/barry20000731.php3
I applied the first step:
First Normal Form
Eliminate repeating groups in individual tables.
Create a separate table for each set of related data.
Identify each set of related data with a primary key.
I came up with two tables:
link id,link_url,link_text,link_image,link comment,link_align,
catagory id, catagory, catagory comment
Second Normal Form
Create separate tables for sets of values that apply to multiple records.
Relate these tables with a foreign key.
A link may have multiple text or images or comments
so I seperated the link_url into a table
Table 1link discriptions) (link_id,link_text,link_img,link_comment,link_align
Table 2unique link url)
url(unique primary key),rellink_id(foreign key)
Table 3:cat_id,cat,cat comment
now I wonder when, how, and where do I relate the catagory to the link?
just conitinuing to step 3
Third Normal Form
Eliminate fields that do not depend on the key. I think this step is done because table 1 the link_id is based on either the text image comment or a combination of the above
this is where I give up and just wing it
table 2: add a relationship for the cat
url(primary key),relcat_id(foreign key one to one?)
change the relationship between table 1 discription and table 2:
table 1: link discription
link_id(primary key),rel_url(foreign key),link_text,link_image,link_comment
ahh crap though I'm hoplessly lost in normiliztion, I think the above schem would work anyone one to suggest how this is done properly?