1) 最简单的形式 SQL 代码 --经确认customers表中所有customer_id小于1000均为'北京' --1000以内的均是公司走向全国之前的本城市的老客户:) update customers set city_name='北京' where customer_id<1000 2) ...
分类:
数据库 时间:
2020-05-28 13:37:27
阅读次数:
70
$criteria = new CDbCriteria;//函数方式 $criteria->addCondition("id=1"); //查询条件,即where id = 1 $criteria->addInCondition('id', array(1,2,3,4,5)); //代表where ...
分类:
数据库 时间:
2020-05-28 11:35:08
阅读次数:
73
题目 The decimal expansion of the fraction 1/33 is 0.03, where the 03 is used to indicate that the cycle 03repeats indefinitely with no intervening digi ...
分类:
其他好文 时间:
2020-05-28 00:54:20
阅读次数:
110
GROUP BY 常用的聚合函数, 可以对数据进行汇总 一般与常见的一些函数一起使用, 汇总数据后一般没有办法进行使用 使用顺序, SELECT, FROM, JOIN, WHERE GROUP BY, HAVING, ORDER BY, LIMIT -- 使用聚合函数 -- MAX() -- MI ...
分类:
其他好文 时间:
2020-05-28 00:33:35
阅读次数:
71
ORDER BY常见的语法 ORDER BY 根据XX列进行排序, 在SELECT, WHERE, GROUP BY后面 LIMIT 一般放在最后, 与ORDER BY一起使用, 主要是对选择数量的限制 # ORDER BY SELECT * FROM customers ORDER BY stat ...
分类:
其他好文 时间:
2020-05-27 23:20:59
阅读次数:
119
聚集函数 count sum avg max min sum、avg、max、min 忽略值为null的行 count(*) 统计行数,包含值为null的行 count(a) 统计a不为null的行数,忽略null count(a=1) 统计a为1的行数 select sum(a*b) as c . ...
分类:
数据库 时间:
2020-05-27 20:44:44
阅读次数:
102
where 匹配时默认不区分大小写 = <> != < <= > >= in is null is not null between 3 and 7 包含3和7 and or not () null=null 返回false,null<=>null返回true select a+ifnull(b, ...
分类:
数据库 时间:
2020-05-27 20:36:23
阅读次数:
101
select a, b, t1.c, a*b as d from t1, db.t2 where a between 3 and 7 or c not in (5,100,124) group by ... having ... order by d desc, e select的列里没有e lim ...
分类:
数据库 时间:
2020-05-27 20:23:31
阅读次数:
93
通配符 where name like 'abc%' like '%' 不会匹配 null 下划线_匹配一个字符 like '[a-z]' like '[^cde]' 正则 regexp 'abc' 等价于like '%abc%' regexp binary 'a|B|c' 区分大小写,匹配 a 或 ...
分类:
数据库 时间:
2020-05-27 20:20:32
阅读次数:
85
分页实现 ThinkPHP5.1内置了分页实现,要给数据添加分页输出功能变得非常简单,可以直接在Db类查询的时候调用paginate方法: 官方Demo // 查询状态为1的用户数据 并且每页显示10条数据 $list = Db::name('user')->where('status',1)->p ...
分类:
Web程序 时间:
2020-05-27 20:09:22
阅读次数:
78