Anda di halaman 1dari 1

create table quotes

(
id int unsigned auto_increment primary key
, author varchar(64)
, quote varchar(4000)
, source varchar(64)
, fulltext(quote)
) engine=innodb;
_______________________________________
-- Get some words and phrases to search for into the table.
insert into quotes (author, quote, source) values
('Abraham Lincoln', 'Fourscore and seven years ago...',
'Gettysburg Address')
, ('George Harrison', 'All those years ago...',
'Live In Japan')
, ('Arthur C. Clarke', 'Then 10 years ago the monolith was discovered.',
'2010: The Year We Make Contact')
, ('Benjamin Franklin',
'Early to bed and early to rise, makes a man healthy, wealthy, and wise.',
'Poor Richard''s Almanack')
, ('James Thurber',
'Early to rise and early to bed makes a male healthy and wealthy and dead.',
'The New Yorker')
, ('K', '1500 hundred years ago, everybody knew that the Earth was the center of
the universe.',
'Men in Black')
;
-----------------------------------------select author as "Monolith" from quotes
where match(quote) against ('monolith' in natural language mode);
------------------------------------------select author as "Ago and Years" from quotes
where match(quote) against ('+ago +years' in boolean mode);
---------------------------------------select author as "Fourscore or Monolith" from quotes
where match(quote) against ('fourscore monolith' in boolean mode);
------------------------------------------select author as "Years and not Monolith" from quotes
where match(quote) against ('+years -monolith' in boolean mode);
-------------------------------------------select quote as "Too Far Apart" from quotes
where match(quote) against (
'"early wise" @20' in boolean mode);
-----------------------------------------------

Anda mungkin juga menyukai