I know how to add a fulltext index and do basic boolean searches...
ALTER TABLE products ADD FULLTEXT KEY myIndex (model, description);
SELECT *
FROM products
WHERE MATCH(model, description) AGAINST('myKeyword' in boolean mode);
However, I am wondering if it's possible to do something like this...
I want my SQL to check if 'myIndex' exists, and if not it should automatically grab existing column names and add a fulltext index (notice the * in place of column names):
ALTER TABLE products ADD FULLTEXT KEY myIndex (*);
Also, when searching the index, can I again automatically grab column names, instead of having to enter them manually (again notice the * in place of column names)...
SELECT *
FROM products
WHERE MATCH(*) AGAINST('myKeyword' in boolean mode);
I don't know the correct syntax, but something like this possible? I've been searching google for hours and am having trouble finding answers. I know I could get PHP to generate the SQL I need, but I am wondering if this is all possible using strictly SQL?
Thanks!