* Bill > Hello Everyone, > I've only just started trying to use MySQL so please forgive my > ignorance if this sounds like a really basic question! > I am trying to search a text field within a table that contains > several keywords; for example the column might be called > "computer_description" and contain the values "i-mac blue 256MB > 500MHz ...". Is there any way of putting together a query that says > something like: > SELECT * from table1 WHERE computer_description CONTAINS 'blue' ?
Yes, you can use the LIKE operator: <URL: http://www.mysql.com/doc/S/t/String_comparison_functions.html > ...it would be: computer_description LIKE '%blue%' This will be slow on a big table. If you have large amounts of data and use version 3.23.23 or later, take a look at the more advanced fulltext search feature: <URL: http://www.mysql.com/doc/F/u/Fulltext_Search.html > See also: <URL: http://www.mysql.com/doc/C/o/Comparison_Operators.html > > or should I separate this column up into several others type, colour, > ram, processor etc...? Yes. :o) <URL: http://www.sqlmag.com/Articles/Index.cfm?ArticleID=4887 > <URL: http://www.gslis.utexas.edu/~l384k11w/normover.html > <URL: http://www.devshed.com/Server_Side/MySQL/Normal/Normal1/page1.html > -- Roger --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php