Database Reference
In-Depth Information
Output
+---------------------------------------------------------------------------+
| note_text |
+---------------------------------------------------------------------------|
| Customer complaint: rabbit has been able to detect trap, food apparently |
| less effective now. |
| Quantity varies, sold by the sack load. All guaranteed to be bright and |
| orange, and suitable for use as rabbit bait. |
+---------------------------------------------------------------------------+
Analysis
The SELECT statement retrieves a single column, note_text . For the WHERE
clause, a full-text search is performed. Match(note_text) instructs MariaDB
to perform the search against that named column, and Against('rabbit')
specifies the word rabbit as the search text. As two rows contained the word
rabbit , those two rows were returned.
Note
Use Full Match() Specification The value passed to Match() must be the same
as the one used in the FULLTEXT() definition. If multiple columns are specified, all of
them must be listed (and in the correct order).
Note
Searches Are Case Insensitive Full-text searches are case insensitive, unless BINARY
mode (not covered in this chapter) is used.
The truth is that the search just performed could just as easily have used a LIKE
clause, as seen here:
Input
SELECT note_text
FROM productnotes
WHERE note_text LIKE '%rabbit%';
Output
+---------------------------------------------------------------------------+
| note_text |
+---------------------------------------------------------------------------|
| Quantity varies, sold by the sack load. All guaranteed to be bright and |
| orange, and suitable for use as rabbit bait. |
| Customer complaint: rabbit has been able to detect trap, food apparently |
| less effective now. |
+---------------------------------------------------------------------------+
Search WWH ::




Custom Search