
MYSQL
qq_28285625
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
group by用法
select DATE_FORMAT(created_time,'%Y-%m-%d') as `day` ,count(*) from tb_user GROUP BY `day` ORDER BY created_time DESC原创 2017-12-21 10:59:48 · 271 阅读 · 0 评论 -
inner join,left join,right join
inner join : condition用where表达 select c.company_id ,c.`name`,i.amount from tb_company_lang as c inner join tb_investor as i where c.company_id=i.company_id 其中inner可以省略 和select c.company_id ,c.原创 2017-12-21 11:56:03 · 153 阅读 · 0 评论 -
is null && is not null
在 MySQL 中,NULL 值与任何其它值的比较(即使是 NULL)永远返回 false,即 NULL = NULL 返回false 。 MySQL 中处理 NULL 使用 IS NULL 和 IS NOT NULL 运算符。 select c.company_id ,c.`name`,i.amount from tb_company_lang as c join tb_inve原创 2017-12-21 18:10:10 · 324 阅读 · 0 评论 -
mysql 正则
mobile以158开头 select user_name,mobile from tb_user where mobile regexp '^158' mobile以22结尾 select user_name,mobile from tb_user where mobile regexp '22$' mobile字段中包含345 select user_name,mobile原创 2017-12-22 11:47:52 · 270 阅读 · 0 评论 -
MYSQL 查询某字段中包含以逗号分隔的字符串的记录方法
表中有个字段是以逗号间隔存储的mineralidmineral11,4,3221,2要根据mineral查询这个表的数据怎么查询呢select * from xxx where find_in_set(2,mineral);查询结果是 :idmineral21,2那么 find_in_set是一个什么函数呢?MySQL提供了一个名为find_in_set()的内置函数,运行在逗号间隔的字符串列表中...原创 2018-05-23 17:13:17 · 8421 阅读 · 0 评论 -
MySql IFNULL函数
IFNULL(expr1,expr2) 如果expr1不是NULL,IFNULL()返回expr1,否则它返回expr2。IFNULL()返回一个数字或字符串值,取决于它被使用的上下文环境。原创 2018-06-14 14:37:46 · 2328 阅读 · 0 评论