Home > Database > Mysql Tutorial > mysql字符串匹配度查询排序_MySQL

mysql字符串匹配度查询排序_MySQL

WBOY
Release: 2016-06-01 13:28:37
Original
1405 people have browsed it

bitsCN.com

mysql字符串匹配度查询排序

 

  实现类似搜索引擎的功能,实现匹配度查询

 

  表结构创建语法   

[sql] CREATE TABLE `people` (    `id` int(11) NOT NULL COMMENT 'id',    `namess` varchar(200) DEFAULT NULL COMMENT '用户名',    PRIMARY KEY (`id`)  ) ENGINE=MyISAM DEFAULT CHARSET=utf8  
Copy after login

常规查询语句

[sql] SELECT * FROM `people` WHERE namess LIKE  '%张%'  ;   
Copy after login

mysql字符串匹配度查询排序_MySQL

使用匹配度查询sql

[sql] SELECT * FROM `people` WHERE namess LIKE  '%张%'   ORDER BY  REPLACE(namess,'张','')    
Copy after login

 

mysql字符串匹配度查询排序_MySQL

 

 

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template