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的结果

  • 相关阅读:
    201141 live the lie until the lie becomes your life
    my php & mysql FAQ
    suger日料财务
    python 应用thrift thrift的监控fb303
    cherryPy学习
    my linux FAQ
    Javascript无阻塞加载方法
    设计模式学习笔记之组合模式模式
    【转】cookie
    C# 多线程
  • 原文地址:https://www.cnblogs.com/crystaltu/p/6700321.html
Copyright © 2011-2022 走看看