zoukankan      html  css  js  c++  java
  • sql语句--查询语句(MySQL)

    1.截取字符串

    left(str, length),right(str, length),substring(str, pos, length)

    原文:http://www.jb51.net/article/27458.htm

    2.显示查询结果的前100条

    select * from tbl limit 100;

    3.将varchar转换成int

    类型:BINARY、CHAR、DATE、DATETIME、DECIMAL、SIGNED [INTEGER]、TIME、UNSIGNED [INTEGER]

    select server_id from cardserver where game_id = 1 order by CAST(server_id as SIGNED) desc limit 10

    select server_id from cardserver where game_id = 1 order by CONVERT(server_id,SIGNED) desc limit 10

    参考:http://blog.sina.com.cn/s/blog_4550f3ca0101qa3l.html

    4.python 读入中文txt乱码

    Python连接MySQL是加上参数 charset=utf8

    参考:http://ju.outofmemory.cn/entry/126

  • 相关阅读:
    js 抓取距离的方法
    mysql 设置账户权限
    mysql 主从复制
    mysql 分区
    linux 安装samba
    linux 配置lamp
    linux 本地虚拟机配置
    linux 权限
    linux 磁盘分区
    mysql-进阶 if/while/case
  • 原文地址:https://www.cnblogs.com/froid/p/5079023.html
Copyright © 2011-2022 走看看