Tags
Asked 2 years ago
9 Jun 2021
Views 215
dilip

dilip posted

query with MATCH on keyword In MySQL

query with MATCH on keyword In MySQL
steave ray

steave ray
answered Apr 26 '23 00:00

[To use MATCH function in MySQL to search for a specific keyword, you can pass the keyword as a parameter to the AGAINST () function.

Here's an example query that searches for the keyword "example" in the text column of the articles table:


SELECT *
FROM articles
WHERE MATCH(text) AGAINST('example')

In this example, we are using the SELECT statement to retrieve all columns from the articles table. We are then using the WHERE clause to filter the results to only include rows where the text column matches the keyword "example". We are using the MATCH() function to perform a full- text search on the text column, and the AGAINST () function to specify the keyword to search for.

Note that to use the MATCH () function with full-text searching, you need to have a full-text index on the columns you want to search. You can create a full-text index using the FULLTEXT keyword in the CREATE TABLE or ALTER TABLE statemen
Post Answer