You can include additional criteria to narrow the search further. : MATCH « FullText Search « SQL / MySQL






You can include additional criteria to narrow the search further.

     
mysql>
mysql> CREATE TABLE mytable
    -> (
    ->     bsect ENUM('O','N') NOT NULL, # book section (testament)
    ->     bname VARCHAR(20) NOT NULL, # book name
    ->     bnum TINYINT UNSIGNED NOT NULL, # book number
    ->     cnum TINYINT UNSIGNED NOT NULL, # chapter number
    ->     vnum TINYINT UNSIGNED NOT NULL, # verse number
    ->     vtext TEXT NOT NULL # text of verse
    -> ) TYPE = MyISAM;
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql>
mysql> ALTER TABLE mytable ADD FULLTEXT (vtext);
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql>
mysql> SELECT COUNT(*) from mytable WHERE MATCH(vtext) AGAINST('database');
+----------+
| COUNT(*) |
+----------+
|        0 |
+----------+
1 row in set (0.00 sec)

mysql>
mysql> SELECT COUNT(*) from mytable WHERE MATCH(vtext) AGAINST('database') AND bsect = 'N';
+----------+
| COUNT(*) |
+----------+
|        0 |
+----------+
1 row in set (0.00 sec)

mysql>
mysql> drop table mytable;
Query OK, 0 rows affected (0.00 sec)

   
    
    
    
    
  








Related examples in the same category

1.A MATCH expression for fulltext search can be used to order results.
2.Use MATCH in where statement
3.MATCH(TITLE) AGAINST ('to')
4.Using match in where clause
5.Using match in select statement
6.Using the same match...against clause in select clause and where clause
7.Matches two words
8.Matches two columns
9.Matches two columns in boolean mode
10.Match two words in boolean mode
11.Match against a long sentence
12.Get the numbers and relevance values of the books in which distributed appears in the summary.
13.Get the numbers and titles of the books in which database appears in the title.
14.Get the numbers and titles of the books in which the phrase design implementation appears.
15.Full-Text Search syntax