RE: [PHP] RE: Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread Jerry Schwartz
>> [JS] I disagree. The method I proposed can be extended to any depth, and >> any >> leaf or branch can be retrieved with a single query. >> > >I suppose for retrievals this structure has advantages, but unless >MySQL has a ++ operator (or better yet, one that adds or subtracts 2 >from an int) th

Re: [PHP] RE: Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread Dotan Cohen
On Thu, Jan 20, 2011 at 21:40, Jerry Schwartz wrote: >>Thanks. I prefer the "parent tag" field, though, I feel that it is >>more flexible. >> >> > [JS] I disagree. The method I proposed can be extended to any depth, and any > leaf or branch can be retrieved with a single query. > I suppose for re

Re: [PHP] RE: Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread David Hutto
tion: surely someone has implemented many >>Boolean values (tags) and a solution exist >> >> >>> As for setting up a hierarchy, that's trickier. One way to handle that is >>> to >>> work like libraries do: 10 is "fiction", 10.05 is "

RE: Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread Jerry Schwartz
>-Original Message- >From: Dotan Cohen [mailto:dotanco...@gmail.com] >Sent: Thursday, January 20, 2011 11:25 AM >To: Jerry Schwartz >Cc: mysql.; php-general. >Subject: Re: Organisational question: surely someone has implemented many >Boolean values (tags) and a solutio

Re: Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread Dotan Cohen
On Thu, Jan 20, 2011 at 17:22, Peter Brawley wrote: > I'd exclude (1) because new tags require restructuring the table, (2) > and (3) because they break a cardinal rule of design and will be a mess > to query, leaving ... > > 4) Standard many-many bridge table: > mysql>  CREATE TABLE items_tags (

Re: Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread Dotan Cohen
On Thu, Jan 20, 2011 at 17:22, Jerry Schwartz wrote: > I think the canonical way would be to have one table for your items, one table > for your tags, and one table for your tag assignments. > Thank you, I do agree that this is the best way. Other posters seem to agree as well! > Using an ever-

RE: Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread Jerry Schwartz
I think the canonical way would be to have one table for your items, one table for your tags, and one table for your tag assignments. CREATE TABLE items ( item_id INT(11) AUTO-INCREMENT PRIMARY KEY, item_name VARCHAR(100) NOT NULL KEY, ... ); CREATE TABLE tags ( tag_id INT(11) AUTO-INCREMENT PRI

Re: Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread Peter Brawley
I'd exclude (1) because new tags require restructuring the table, (2) and (3) because they break a cardinal rule of design and will be a mess to query, leaving ... 4) Standard many-many bridge table: mysql> CREATE TABLE items_tags ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, itemID int, t