2021年9月13日
摘要: 使用连接池有两种方式 1.使用DBCP,在maven项目中导入包 <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-dbcp2 --> <dependency> <groupId>org.apache.commons 阅读全文
posted @ 2021-09-13 20:21 学海无涯,书山有路 阅读(59) 评论(0) 推荐(0)
摘要: 解析json字符串有两种方式 1.使用谷歌的Gson,在maven项目的pom文件中导入包 <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson --> <dependency> <groupId>com.google.c 阅读全文
posted @ 2021-09-13 20:03 学海无涯,书山有路 阅读(524) 评论(0) 推荐(0)
摘要: shell操作mysql #!/bin/sh MYSQL="mysql -hmaster -uroot -p123456" sql="select * from shujia.student where sex='0'" result="$($MYSQL -e "$sql")" echo "$res 阅读全文
posted @ 2021-09-13 19:39 学海无涯,书山有路 阅读(30) 评论(0) 推荐(0)
摘要: case:值的替换 格式: case when 条件 then 为true的结果 [when 条件 then 为true的结果] [else 为false的结果] end 从其他表加载数据 格式1: create table 表名 as 查询语句; 格式2: insert into 表名 查询语句; 阅读全文
posted @ 2021-09-13 19:30 学海无涯,书山有路 阅读(24) 评论(0) 推荐(0)
摘要: 连表联查 union:结果集进行合并(纵向合并) 格式: 查询语句 union 查询语句 注意: 查询列数必须相同 字段为第一个sql语句的字段 union默认去重 union all不去重 left join(以左表为基准关联右表中的数据) 格式: select * from 左表 left jo 阅读全文
posted @ 2021-09-13 19:24 学海无涯,书山有路 阅读(27) 评论(0) 推荐(0)
摘要: 字段进行算术运算 格式: (字段 符号 字段) 例如: select (name+age) from students; 注意: 字符串参与运算字符串为0参与运算 拼接: 格式: concat(str1,str2...) 例如:把name和age以-拼接显示 select concat(name,' 阅读全文
posted @ 2021-09-13 19:21 学海无涯,书山有路 阅读(30) 评论(0) 推荐(0)
摘要: set @@global.sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; 然后关闭连接 阅读全文
posted @ 2021-09-13 19:18 学海无涯,书山有路 阅读(38) 评论(0) 推荐(0)
摘要: 1、关闭防火墙 systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 查看防火墙状态 systemctl status firewalld.service 启动 阅读全文
posted @ 2021-09-13 19:13 学海无涯,书山有路 阅读(13) 评论(0) 推荐(0)
  2021年9月3日
摘要: if 格式1: if 判断条件 then 判断为true执行的代码 fi 格式2: if 判断条件 then 判断为true执行的代码 else 判断为false执行的代码 fi 格式3: if 判断条件 then 判断为true执行的代码 elif 判断条件 then 判断为true执行的代码 。 阅读全文
posted @ 2021-09-03 20:08 学海无涯,书山有路 阅读(35) 评论(0) 推荐(0)
摘要: shell是操作linux的桥梁 创建: 后缀为.sh的文件 编写: 头部注释为#!/bin/sh或者#!/bin/bash(注释可写可不写,建议写上) 运行: 1.通过sh命令执行 例如:sh helloworld.sh 2.通过bash命令执行 例如:bash helloworld.sh 3.通 阅读全文
posted @ 2021-09-03 20:04 学海无涯,书山有路 阅读(35) 评论(0) 推荐(0)