zoukankan      html  css  js  c++  java
  • 利用中文拼音首字母查询数据库

    1.创建表

    CREATE TABLE `x_ch2en` (
      `id` int(10) NOT NULL AUTO_INCREMENT,
      `ch` varchar(20) DEFAULT NULL COMMENT '中文',
      `en` varchar(20) DEFAULT NULL COMMENT '中文对应的字母',
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8 COMMENT='中文对应字母表';

    2.插入中英对照数据

    insert   into   x_ch2en(ch,en)   
    select   '', 'A '   union   all   select   '', 'B '   union   all   
    select   '', 'C '   union   all   select   '', 'D '   union   all   
    select   '', 'E '   union   all   select   '', 'F '   union   all   
    select   '', 'G '   union   all   select   '', 'H '   union   all   
    select   '', 'J '   union   all   select   '', 'K '   union   all   
    select   '', 'L '   union   all   select   '', 'M '   union   all   
    select   '', 'N '   union   all   select   '', 'O '   union   all   
    select   '', 'P '   union   all   select   '', 'Q '   union   all   
    select   '', 'R '   union   all   select   '', 'S '   union   all   
    select   '', 'T '   union   all   select   '', 'W '   union   all   
    select   '', 'X '   union   all   select   '', 'Y '   union   all   
    select   '', 'Z '

    3.用 where user_name>='' and user_name <'八' 来查询中首字母为A的结果

  • 相关阅读:
    计算机网络协议如何学习之换位思考
    tcp/ip协议
    JSP页面中的元素
    动态网页脚本语言
    php的学习经验
    jsp、php和asp之间的区别
    Reactor 线程模型
    Hadoop集群搭建
    hadoop单点配置
    Docker 安装脚本
  • 原文地址:https://www.cnblogs.com/crystaltu/p/6700321.html
Copyright © 2011-2022 走看看