Simple BOOLEAN search

suggest change
SET @searchTerm= '+Database +Programming -Java';
SELECT MATCH (Title) AGAINST (@searchTerm IN BOOLEAN MODE) Score,
    ISBN, Author, Title 
FROM book
WHERE MATCH (Title) AGAINST (@searchTerm IN BOOLEAN MODE)
ORDER BY MATCH (Title) AGAINST (@searchTerm IN BOOLEAN MODE) DESC;

Given a table named book with columns named ISBN, Title, and Author, this searches for titles that contain both Database and Programming and do not contain Java. In boolean mode a bare word is optional. + requires it and - excludes it.

For this to work, a fulltext index on the Title column must be available:

ALTER TABLE book ADD FULLTEXT INDEX Fulltext_title_index (Title);

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents