01 2022 档案

摘要:两种方式 1 create index idx_xxx on table(xxx); 2 alter table xxx add index idx_xxx(field); 阅读全文
posted @ 2022-01-29 11:28 江湖凶险 阅读(42) 评论(0) 推荐(0) 编辑
摘要:1)添加列 alter table xxx add column xxx int default 0 comment 'xxx'; 指定列的位置可以使用关键字:FIRST、AFTER FIRST表示将列添加为表中的第一个,AFTER表示将列添加到某个列之后。没有before一说。 2)修改列名 al 阅读全文
posted @ 2022-01-25 17:37 江湖凶险 阅读(171) 评论(0) 推荐(0) 编辑
摘要:1)int[][] a = new int[][]{}; 不指定行数与列数,直接初始化 {} 2)int[][] b = new int[10][]; 可以只定义行数 3)int[][] c = new int[20][20]; 指定行数与列数 4)int[]d[] = new int[5][5]; 阅读全文
posted @ 2022-01-21 11:57 江湖凶险 阅读(180) 评论(0) 推荐(0) 编辑
摘要:借鉴别人的图示,直观清晰 阅读全文
posted @ 2022-01-20 11:51 江湖凶险 阅读(21) 评论(0) 推荐(0) 编辑
摘要:1) int a = 0b10111; 0b开头表示二进制数 2) int b = 0127; 0开通表示8进制数 3) int c 0x187Fde; 0x或者0X开头表示16机制数 阅读全文
posted @ 2022-01-20 11:20 江湖凶险 阅读(538) 评论(0) 推荐(0) 编辑
摘要:timestampdiff(unit, param1, param2) 。其中unit可以是 minute, hour, second, day等,计算方式是 param2 - param1。 获取 date_sub / date_add(param, interval xxx unit),将日期参 阅读全文
posted @ 2022-01-18 11:25 江湖凶险 阅读(34) 评论(0) 推荐(0) 编辑
摘要:mysql日期处理 select DATE_ADD(field, interval xxx day|month|year) from xxx; DATE_ADD 对日期进行加运算,DATE_SUB 对日期进行减运算 例: select date_add(create_time, interval 1 阅读全文
posted @ 2022-01-17 15:30 江湖凶险 阅读(36) 评论(0) 推荐(0) 编辑
摘要:distinct多个字段 比如查看用户每天登陆app的情况, select distinct user_id, date from xxx; 查询结果可能为: 1001 2022-01-11 1001 2022-01-16 1002 2022-01-06 1002 2022-01-12 阅读全文
posted @ 2022-01-17 15:23 江湖凶险 阅读(196) 评论(0) 推荐(0) 编辑
摘要:select day(date), month(date), year(date) from user; day, month, year取出的是数字 阅读全文
posted @ 2022-01-17 11:19 江湖凶险 阅读(502) 评论(0) 推荐(0) 编辑
摘要:mysql查询语句中的条件判断 case when then else end 1)case等值分析 select case sex when 1 then '男' when 0 then '女' else '没有设置' end as '性别' from xxx 2)case范围分析 select 阅读全文
posted @ 2022-01-14 19:20 江湖凶险 阅读(103) 评论(0) 推荐(0) 编辑
摘要:select * from t1 where a = xxx union (distinct, 默认为distinct,会过滤掉重复记录,可指定all,则不会过滤重复记录) select * from t1 where b = xxx 阅读全文
posted @ 2022-01-14 17:52 江湖凶险 阅读(484) 评论(0) 推荐(0) 编辑
摘要:mysql语句的 <, >, != 等符号查询都会过滤掉字段值为null的记录,若结果中想要获取到字段值为null的记录,需要单独加上一条判断 where xxx is null or xxx 阅读全文
posted @ 2022-01-14 17:50 江湖凶险 阅读(562) 评论(0) 推荐(1) 编辑
摘要:在mysql中,round用于数据的四舍五入。有两种形式 1)round(x, d),x为要处理的小数,d为要保留小数点后几位。 2)round(x),其实等于round(x, 0),即不保留小数位。 例:select round(avg(play_times),1) from video; 阅读全文
posted @ 2022-01-13 11:39 江湖凶险 阅读(157) 评论(0) 推荐(0) 编辑
摘要:grep -rn 'xxx' * * 表示当前目录所有文件,也可以指定某个文件 -r 表示递归查找 -n 表示显示行号 -R 查找所有文件包含子目录 -i 忽略大小写 参考:https://www.cnblogs.com/wangkongming/p/4476933.html 阅读全文
posted @ 2022-01-10 14:55 江湖凶险 阅读(63) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示