
mysql
文章平均质量分 62
ccyy-Csdn
干就完了
展开
-
mysql 5.7版本数据库json字段筛选
mysql 5.7版本数据库json字段筛选原创 2022-12-16 20:20:20 · 823 阅读 · 1 评论 -
mysql统计每年1-12月份的数据量或者是否有数据
select firm_name,sum(case month(time) when '1' then 1 else 0 end) as 一月份,sum(case month(time) when '2' then 1 else 0 end) as 二月份,sum(case month(time) when '3' then 1 else 0 end) as 三月份,sum(case ...原创 2019-09-05 15:35:29 · 1365 阅读 · 0 评论 -
mysql global.sql_mode 采坑之路 解决
报错:#4 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'ws.t_sys_cat.ARG1' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_m...原创 2019-01-18 11:24:47 · 12125 阅读 · 0 评论 -
windows (server) mysql卸载安装
windows2008 r2版本:卸载服务在命令行输入net stop mysqld:\mysql\bin\mysqld -remove安装服务在命令行输入d:\mysql\bin\mysqld -installnet start mysql开始——》管理工具——》服务...原创 2019-01-17 16:38:58 · 3530 阅读 · 0 评论 -
mysql5.7、8.0数据库账号密码设置以及权限分配
登录数据库:# mysql -u root -p输入密码首先mysql的用户账号以及权限信息都保存在mysql.user表中查询mysql.user的所有用户信息SELECT host,user,authentication_string password FROM mysql.user;以下新建用户和修改权限语法与数据库版本有关1、新建数据库账...原创 2018-11-21 20:14:50 · 2955 阅读 · 1 评论 -
sql一对多字符串拼接
使用group_concat()配合GROUP BYSELECT group_concat(share_ord_date.star_time),share_ord.* FROM `share_ord`left JOIN share_ord_date on share_ord_date.share_ord_id=share_ord.idGROUP BY share_ord.id; ...原创 2018-11-19 10:22:15 · 1391 阅读 · 0 评论 -
java.sql.SQLException: Incorrect string value: '\xF0\x9F\x90\x9B],...' for column 'DESCR' at row 1问题
今天在项目中碰到这样的报错,原因是特殊字符无法插入数据库,只需要将数据库字段做以下修改:项目为微信公众号,其中微信用户的昵称,当你读取保存的时候用户的微信昵称可能包含特殊字符所以在数据库所有有关保存用户微信昵称的字段都必须修改成utf8mb4的字符集...原创 2018-11-10 13:35:07 · 1224 阅读 · 0 评论 -
mysql 根据汉字首字母排序
1:如果数据库表字段的字符编码是latin1_swedish_ciselect * from tablename order by birary(name) asc ; 2:如果数据库表字段的字符编码是utf8_general_ci(常用)select * from tablename WHERE 1=1 order by CONVERT( name USING gbk ...转载 2018-10-30 14:25:26 · 714 阅读 · 0 评论 -
要求:如果某个字段=1就立刻显示,否则10分钟以后显示,-----sql语句
select a.* FROM(SELECT *,DATE_ADD(create_date, INTERVAL 10 MINUTE)<SYSDATE() isDelayFROM `car_teams_ord`) a where IF(iss_price=1||iss_price=0,1=1,a.isDelay=1)思路:1、DATE_ADD(create_date, IN...原创 2018-09-18 18:17:09 · 707 阅读 · 1 评论 -
sql中where加if
SELECT *FROM T_ORDWHEREIF ( xd__T_ORD.LOG_STAT_CD >= 3050.160,-- 条件 LOG_STAT_CD >= 3050.160 -- true AND LOG_STAT_CD <= 3050.220, AND LOG_STAT_CD ...原创 2018-08-29 17:14:51 · 23209 阅读 · 4 评论 -
mysql时间筛选date_sub的用法
场景:如上筛选出订单创建超出15分钟的订单并做删除操作 select * FROM `t_ord` WHERE date_sub(NOW(), interval '0 0:15:0' day_second)>CRT_TM如上使用: date_sub(NOW(), interval '0 0:15:0' day_second)可以把当前时间减去15分钟再与订单创建时间进行对比...原创 2018-08-20 17:33:27 · 2200 阅读 · 0 评论