Requiring or Excluding FULLTEXT Search Words : Word « FullText Search « SQL / MySQL






Requiring or Excluding FULLTEXT Search Words

    
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.03 sec)
Records: 0  Duplicates: 0  Warnings: 0

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

mysql>
mysql> SELECT COUNT(*) FROM mytable WHERE MATCH(vtext) AGAINST('David') AND MATCH(vtext) AGAINST('Goliath');
+----------+
| 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.Performs an OR search for any of the words.
2.Noise Words
3.Get the numbers and titles of the books in which the word to appears.
4.Get the numbers and titles of the books in which the word database appears.
5.Get the numbers and titles of the books in which the word practical appears.
6.Get the numbers and relevance values of the books in which the word introduction appears in the title.
7.Get the numbers and titles of the books in which the word practical and/or the word distributed appears in the
8.Get the numbers and titles of the books in which the word careers appears in the title and/or the summary.
9.Get the numbers and titles of the books in which the word database and/or the word design appears.
10.Get the numbers and titles of the books in which the words database and design appear.
11.Give the numbers and titles of the books in which the word database appears, but not the word design.
12.Get the numbers and titles of the books in which words appear that begin with data.
13.Give the numbers and titles of the books in which the word sql appears.
14.Search for a word