mysql like语句
2015-08-06 16:50
771 查看
数据库模糊查询like语句:
$sql = "select * from table where title like '%中国%'";
//包含“中国”两个字
$sql = "select * from table where title like '中国%'";
//以“中国”开头
$sql = "select * from table where title like '%中国'";
//以“中国”结尾
$sql = "select * from table where title like '[ALN]%'";
//以A、L、N开头
$sql = "select * from table where title like '%[ALN]'";
//以A、L、N结尾
$sql = "select * from table where title like '[!ALN]%'";
//不以A、L、N开头
in语句:
$sql = "select * from table where name in ('张','梁');
//获取name等于“张”或者“梁”的信息
mysql_num_rows()
//获取结果集中行的数
ceil() //向上取整数
floor()
//向下取整数
mysql教程:http://www.w3school.com.cn/sql/index.asp
$sql = "select * from table where title like '%中国%'";
//包含“中国”两个字
$sql = "select * from table where title like '中国%'";
//以“中国”开头
$sql = "select * from table where title like '%中国'";
//以“中国”结尾
$sql = "select * from table where title like '[ALN]%'";
//以A、L、N开头
$sql = "select * from table where title like '%[ALN]'";
//以A、L、N结尾
$sql = "select * from table where title like '[!ALN]%'";
//不以A、L、N开头
in语句:
$sql = "select * from table where name in ('张','梁');
//获取name等于“张”或者“梁”的信息
mysql_num_rows()
//获取结果集中行的数
ceil() //向上取整数
floor()
//向下取整数
mysql教程:http://www.w3school.com.cn/sql/index.asp
相关文章推荐
- mysql 数据备份与还原
- mysql指令
- MYSQL里的函数
- mysql 判断指定条件数据存不存在,不存在则插入
- MySql连接10060问题教训
- mysql 字段类型VARCHAR转换成DECIMAL
- 导出mysql数据表
- Mysql onduplicate key
- mysql 二进制安装文件 下载
- 摘抄 mysql 相关信息
- mysql 普通表转分区表
- MySQL Cluster初步学习资料整理--安装部署新特性性能测试等
- mysql-proxy 读写分离
- mysql Amoeba 配置
- mysql 误删root
- mysql 慢查询说明
- 安装mysql Install/Remove of the Service Denied!错误的解决办法
- mysql 查看数据大小语句
- MySQL 事件调度器创建
- [转载]Mysql导出表结构及表数据 mysqldump用法