Skip to content

Instantly share code, notes, and snippets.

View nihaokid's full-sized avatar

wei zhai nihaokid

  • Thoughtworks
  • xi'an
View GitHub Profile
problem:
1. give a list, 1 to 10
2. get even number
3. divided by two
4. print them
@nihaokid
nihaokid / search.sql
Created June 12, 2017 15:09
mysql order by relevance or search function
/*
https://dev.mysql.com/doc/refman/5.6/en/fulltext-search.html
https://dev.mysql.com/doc/refman/5.6/en/indexes.html
https://stackoverflow.com/questions/11144394/order-sql-by-strongest-like
*/
CREATE FULLTEXT INDEX index_name
ON table_name (col1, col2, col3)
SELECT * FROM table_name
WHERE MATCH (col1,col2,col3)