I have a table in a database with a structure like this
Keywords
- id int(11)
- U_id int(11)
- keywords text
- create_date int(11)
U_id is a foreign key, id is the primary key
The keywords field is a list of words created by users separated by commas
I was wondering if someone could suggest an efficient query to search such a table.
If you using MyISAM, you can create a fulltext index on field
keywords. Then search using:Of course CSV in a database is just about the worst thing you can do. You should put keywords in a separate table. Make sure to use InnoDB for all tables.
Now you can select using:
Much much faster than CSV.