Name
MATCH() AGAINST()
Synopsis
MATCH(column[, ...]) AGAINST (string)
This function is used only for columns indexed by a
FULLTEXT index, and only in
WHERE clauses. In these clauses, it can be a condition used to search
columns for a given string. Text in the string containing spaces is
parsed into separate words, so a column matches if it contains at
least one word. Small words (three characters or less) are ignored.
Here is an example:
SELECT applicant_id
FROM applications
WHERE MATCH (essay) AGAINST ('English');This SQL statement searches the table containing data on people
applying for admission to the college. The essay
column contains a copy of the applicant’s admission essay. The column
is searched for applicants who mention the word
English, so that a list of applicants who have
voiced an interest in the English program will be displayed.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access