Skip to content

Instantly share code, notes, and snippets.

@realmgic
Created December 11, 2016 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save realmgic/7fefe60069e894159108787840a2ddd4 to your computer and use it in GitHub Desktop.
Save realmgic/7fefe60069e894159108787840a2ddd4 to your computer and use it in GitHub Desktop.
use doag;
set autocommit=0;
drop table if exists quotes;
create table quotes
( id int unsigned auto_increment primary key
, author varchar(64) , quote varchar(4000)
, source varchar(64)
, fulltext(quote)
) engine=innodb;
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')
;
commit;
select * from quotes
select author as "Monolith" from quotes
where match(quote) against ('monolith' in natural language mode);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment