fulltext mysql code example

Example 1: text search in mysql

SELECT * FROM table_name WHERE MATCH(col1, col2)
AGAINST('search terms' IN NATURAL LANGUAGE MODE)

Example 2: enable full text search mysql

ALTER TABLE table_name  
ADD FULLTEXT(column_name1, column_name2,)

Example 3: text search in mysql

mysql> CREATE TABLE tutorial (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, 
title VARCHAR(200), 
description TEXT, 
FULLTEXT(title,description)
) ENGINE=InnoDB;
Query OK, 0 rows affected (2.40 sec)

Tags:

Sql Example