Name
MATCH ( ) AGAINST( )
Synopsis
MATCH(column[, ...]
) AGAINST (string
)
Use this
function in WHERE
clauses as a condition to search
table columns for a given string. Text in the string delimited by
spaces or quotes is parsed into separate words. Small words (three
characters or less) are ignored. Then the words are used for
searching columns. It requires a FULLTEXT
index
for columns searched.
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 university. 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 that have voiced an interest in the English program will be displayed.
Get MySQL in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.