View Single Post

   
  #2 (permalink)  
Old 03-09-2008, 02:37 PM
Bruno Barberi Gnecco
 
Posts: n/a
Default Re: TagCloud Table Structure?

pbd22 wrote:
> Hi.
>
> I need some help with a tag-cloud.
> I am wondering a few things:
> 1) Should I be allowing repetition in my table inserts?
> 2) I am assuming yes, and, if this is the case, then I am
> guessing that the count goes up for all tags of the same name?
> How is that done?


Why not do something like this:

CREATE TABLE tag (
id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
tagname VARCHAR(50) NOT NULL,

PRIMARY KEY(id),
UNIQUE(tagname)
);

CREATE TABLE tag_schedule (
tag INTEGER UNSIGNED NOT NULL,
target INTEGER UNSIGNED NOT NULL,

PRIMARY KEY (tag, target),
KEY (tag),
KEY (target),
FOREIGN KEY (tag) REFERENCES tag(id),
FOREIGN KEY (target) REFERENCES Schedule(id)
);


--
Bruno Barberi Gnecco <brunobg_at_users.sourceforge.net>
Reply With Quote