MySQL Tutorial

MySQL Tutorial MySQL Features MySQL Database Introduction MySQL Environmental Setup MySQL Data Types MySQL variable MySQL Advance table Query MySQL database queries MySQL Entity-Relationship Model MySQL Table Query MySQL Operators MySQL logical conditions MySQL Queries MySQL Clauses Clustered vs Non-Clustered Index MySQL Full text index MySQL Descending Index MySQL Invisible Index MySQL Composite Index MySQL Prefix index MySQL Index MySQL Create index MySQL Drop Index MySQL Show index MySQL Unique index MySQL Table MySQL Variable MySQL View MySQL Constraints MySQL Command Line Client Basic Queries MySQL Stored Procedure MySQL IF Statement MySQL Subquery MySQL Triggers

MySQL Join

MySQL Join MySQL CROSS JOIN MySQL DELETE JOIN MySQL EQUI JOIN MySQL INNER JOIN MySQL Union MySQL NATURAL JOIN MySQL RIGHT JOIN MySQL SELF JOIN MySQL UPDATE JOIN

MySQL Function

MySQL Function MySQL AVG() Function MySQL SUM() Function MySQL String() Function MySQL Advance() Function MySQL Aggregate() Function MySQL COALESCE() Function MySQL Control Flow Function MySQL COUNT() Function MySQL Date And Time Function MySQL GREATEST() Function MySQL ISNULL() Function MySQL LEAST() Function MySQL Math() Function MySQL MAX() Function MySQL MIN() Function MySQL find_in_set() function MySQL ASIN() Function MySQL CEIL() function MySQL CEILING() function MySQL TAN() Function MySQL Truncate() Function MySQL FLOOR() function MySQL LN() function MySQL LOG2() function MySQL LOG10() function MySQL MOD() function MySQL PI() function MySQL POW() function MySQL RADIANS() function MySQL RAND() function MySQL ROUND() function MySQL Character Length Function MySQL Current Date Function MySQL Date Add Function MySQL Date Format Function MySQL Datediff Function MySQL Day Function MySQL Elt Function MySQL Export Set Function MySQL Field Function MySQL Format Function MySQL From Base64 Function MySQL Hex Function MySQL Insert Function MySQL Instr Function MySQL Length Function MySQL CONCAT() function MySQL FIND_IN_SET() function MySQL LIKE() function MySQL LOAD_FILE() function MySQL LOCATE() function MySQL LOG() function MySQL MONTHNAME() function MySQL NOW() function MySQL PERIOD_ADD() function MySQL PERIOD_DIFF() function MySQL POWER() function MySQL QUARTER() function MySQL REVERSE() function MySQL RIGHT() Function MySQL RPAD() function MySQL RTRIM() function MySQL SEC_TO_TIME() function MySQL SOUNDEX() function

Questions

Which Clause is Similar to Having Clause in MySQL

Misc

MySQL Error 1046 - No Database Selected Failed to Start MySQL Service Unit MySQL Service Unit not Found Import MySQL Connector Mudule not Found Error No Module Named MySQL Joins Available in MySQL MySQL Docs MySQL Download For Windows 7 64 Bit MySQL Error Code 1064 MySQL Export MySQL History MySQL Host MySQL Import MySQL Drop All Tables MySQL Drop MySQL Error Code 1175 MySQL Events MySQL Except MYSQL Foreign Key Constraint MySQL If Exists MySQL IndexOf MySQL List All Tables json_extract in MySQL TIMESTAMPDIFF in MySQL MySQL Syntax Checker Sudo MySQL Secure Installation

MySQL Full text index

Full text index

The full-text index in the table isused to search the full text of the data. This index assigns to the table using a "FULLTEXT" keyword. First, the table column changes, then the full-text index updates or recreate. MySQL version 5.6 allows using a full-text index in the table. The full-text index is used to create a table, create an index, and alter table statements.

Syntax

The basic syntax of the full-text index shows below.

FULLTEXT (column1, column2, … column)

The syntax of the full-text index with the create table command shows below.

 CREATE TABLE table_name (Column1 data type NOT NULL PRIMARY KEY,
 Column2 data type NOT NULL,
 Column3 data type NOT NULL,
 FULLTEXT (column1,column2,..)) 

The syntax of a full-text index with create index command shows below.

 CREATE FULLTEXT INDEX iname
 ON table name
 (column1,column2,..)) 

The syntax of the full-text index with alter table command shows below.

 ALTER TABLE tname
 ADD INDEX (column1,column2, …); 

The syntax of drop full-text index with alter table command shows below.

ALTER TABLE tnameDROP INDEX iname;

Examples of the FULLTEXT Index

1) Example: The basic full-text index example shows below.

Execute the following query to know about the full-text index. Here, we use a single column for the full-text key.

 mysql> create table index_table(
 roll_number INT NOT NULL AUTO_INCREMENT,
 phone INT NOT NULL,
 name VARCHAR(10) NOT NULL,
 mark text NOT NULL,
 comment text NOT NULL,
 img blob NOT NULL,
 PRIMARY KEY (roll_number),
 FULLTEXT KEY (mark)); 

OUTPUT

Execute the below query to get the full-text index and its information.

mysql> show index from index_table;
MySQL: Full text index

2) Example: The multiple full-text index example shows below.

Execute the following query to know about the "FULLTEXT" index. Here, you use multiple columns for the FULLTEXT key.  It would be best if you created a new table with the multiple "FULLTEXT" indexes.

 mysql> create table index_table(
 roll_number INT NOT NULL AUTO_INCREMENT,
 phone INT NOT NULL,
 name VARCHAR(10) NOT NULL,
 mark text NOT NULL,
 comment text NOT NULL,
 img blob NOT NULL,
 PRIMARY KEY (roll_number),
 FULLTEXT KEY (name, mark, comment)); 

OUTPUT

Execute the below query to get the full-text index and its information.

mysql> show index from index_table;
MySQL: Full text index

The above table image displays the index and its type. For example, the BTREE index type is represented by the primary index. The mark, name, and comment index show the "FULLTEXT" index type.

3) Example: The full-text index with the existing table example shows below.

Execute the following query to know about the "FULLTEXT" index. Here, you use single columns tothe FULLTEXT index on the existing table. You can create either single or multiple indexes on the available table.

 mysql> CREATE FULLTEXT INDEX name
 ON index_table (mark); 

OUTPUT

Execute the below query to get the full-text index and its information.

mysql> show index from index_table;
MySQL: Full text index

The above table shows the mark and name column as a full-text index type.  Here the mark index is already available, and the name index is created into an existing table.

4) Example: The full-text index with the existing table example shows below.

Execute the following query to know about the "FULLTEXT" index with ALTER table command. Here, you use multiple columns tothe FULLTEXT index on the existing table.It allows us to create either single or multiple indexes on the available table.

mysql> ALTER table index_table
ADD FULLTEXT (name, mark, comment);

OUTPUT

Execute the below query to get the full-text index and its information.

mysql> show index from index_table;
MySQL: Full text index

The above image shows an index with a full-text index type. The name and mark columns assign multiple times with different key names. You either create a full-text index or add an index on an existing table.

5) Example: The drop full-text index with the existing table example shows below.

Execute the following query to know about delete the "FULLTEXT" index with the ALTER table command. Here, you will deletemultiple columns ofthe FULLTEXT index from the existing table.

 mysql> ALTER table index_table
 DROP index name; 

OUTPUT

Execute the below query to get the full-text index and its information.

mysql> show index from index_table;
MySQL: Full text index

The output images displayed the available index and its type. Here the name_2 index is deleted from the table.