You are here: Re: Help with SQL "sets" « PHP Programming Language « IT news, forums, messages
Re: Help with SQL "sets"

Posted by Jerry Stuckle on 05/27/05 04:47

glakk@potatoradio.f2s.com wrote:
> I want to build an application that would let people search records of
> content, based on keywords. The content record table would have a field
> called 'tags' which would be a comma-seperated string of keywords. It
> would be very simple to search for records where the user enters only
> one keyword, by searching for the keyword within the keyword string
> in the record.
>
> But I'd like to let the user enter more than one keyword, and be able
> to select records that have -any- keywords that match -any- of the
> keywords the user enters. And, have the results sorted by how many
> matching keywords are found.
>
> I know that MySQL has a "set" data type, but I have no idea whether
> it would apply to this problem, or how to use it.
>
> Can anyone help?
> TIA,
>

Look into normalizing databases.

A properly normalized database would never have multiple fields in a
column like this. Rather, create another table which two columns. The
first column is an id from the first table; the second column is ONE
keyword.

Now you can search the second table and get the appropriate keys for the
rows in the first table.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация