Re: [sqlite] a system for arbitrarily tagging rows in a table

2009-07-26 Thread P Kishor
On Sun, Jul 26, 2009 at 9:23 PM, Jay A. Kreibich wrote: > On Sat, Jul 25, 2009 at 09:26:16AM -0700, Jim Showalter scratched on the wall: >> You can have the tags in a separate table that has a foreign-key to >> the table with the rows in in you want to tag, > >  That's essentially

Re: [sqlite] a system for arbitrarily tagging rows in a table

2009-07-26 Thread Jay A. Kreibich
On Sat, Jul 25, 2009 at 09:26:16AM -0700, Jim Showalter scratched on the wall: > You can have the tags in a separate table that has a foreign-key to > the table with the rows in in you want to tag, That's essentially what the OP is doing, except they've built a many-to-many relationship

Re: [sqlite] a system for arbitrarily tagging rows in a table

2009-07-25 Thread Jim Showalter
You can have the tags in a separate table that has a foreign-key to the table with the rows in in you want to tag, and then do a select from that table to find the tagged rows. If you need to search for multiple tags at a time, each requires a join: select t from tagged as t join t.tags as

Re: [sqlite] a system for arbitrarily tagging rows in a table

2009-07-24 Thread Jay A. Kreibich
On Fri, Jul 24, 2009 at 09:20:29PM -0500, P Kishor scratched on the wall: > I am trying to develop a "tagging" system, whereby each row in a table > can be tagged with arbitrary number of tags. This smells of a Relational division problem. If you're dealing with tags you might want to have a

Re: [sqlite] a system for arbitrarily tagging rows in a table

2009-07-24 Thread Simon Slavin
On 25 Jul 2009, at 3:20am, P Kishor wrote: > I am trying to develop a "tagging" system, whereby each row in a table > can be tagged with arbitrary number of tags. As an alternative for using a table for tags, consider using a long string instead. The default value for this column would be

[sqlite] a system for arbitrarily tagging rows in a table

2009-07-24 Thread P Kishor
I am trying to develop a "tagging" system, whereby each row in a table can be tagged with arbitrary number of tags. TABLE foo (f_id INTEGER PRIMARY KEY, f_name TEXT); TABLE tag (t_id INTEGER PRIMARY KEY, t_name TEXT); TABLE foo_tag (f_id INTEGER, t_id INTEGER); foo 1, one 2, two 3, three 4,