This is a discussion on TagCloud Table Structure? within the MySQL forums, part of the Database Server Software category; --> Hi. I need some help with a tag-cloud. I am wondering a few things: 1) Should I be allowing ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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? Below is my table structure: CREATE TABLE IF NOT EXISTS mcs.tagcloud ( TagID int(10) unsigned NOT NULL auto_increment, ScheduleID int(10) unsigned NOT NULL, Tag varchar(100) NOT NULL, count int(11) NOT NULL default '0', hits int(11) NOT NULL default '0', PRIMARY KEY (TagID), KEY ScheduleID (ScheduleID), FOREIGN KEY (ScheduleID) references CommonSchedule(ScheduleID) on delete cascade on update cascade ) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
| |||
| 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> |
| Thread Tools | |
| Display Modes | |
|
|