SQL: Introduction to Full Text Search Functions

CREATE TABLE news_articles (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
title VARCHAR(200) NOT NULL
body TEXT NOT NULL
FULLTEXT(title, body);
ALTER TABLE news_articles
ADD FULLTEXT(title, body);
MATCH (column_1, column_2, ..., column_n) 
AGAINST (expression <search_modifier>)
SELECT title, body
FROM news_articles
WHERE MATCH (title, body)
AGAINST ('health care' IN NATURAL LANGUAGE MODE);
SELECT
MATCH(title, body) AGAINST ('health care' IN NATURAL LANGUAGE MODE) AS Relevance,
title,
body
FROM news_articles
WHERE MATCH (title, body)
AGAINST ('health care' IN NATURAL LANGUAGE MODE)
LIMIT 10;

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store