
数据库
hi_link
java软件设计
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
mybatis将时间存入数据库后,只有日期,时分秒全是0
问题原因分析a.数据库字段类型问题: mysql数据库中,date 为年月日;time为时分秒;datetime为年月日时分秒pgsql数据库中,Date为年月日,timestamp为年月日时分秒b.mybatis中jdbcType:#{create_time,jdbcType=DATE}改为 #{create_time,jdbcType=TIMESTAMP}秒带小数点问题解决见 ---秒带小数点问题...原创 2021-05-08 10:02:23 · 1556 阅读 · 2 评论 -
sql降序排列,null排到前面问题
解决方法:order by update_time desc NULLS LAST示例:修改前:select * from dict order by create_time desc,update_time desc修改后:select * from dict order by create_time desc,update_time desc NULLS LAST原创 2021-05-08 09:34:25 · 777 阅读 · 0 评论 -
postgresql的int4类型
1.postgresql的int4类型中的长度为4个字节,32位2.postgresql 中int4类型截图如下:注:PG中int4类型对应的是SQL标准中的INTEGER类型,而且PG实现的是源生的integer类型,是定长4字节(=32位bit)。其对应的十进制取值范围是-21474836478 ~ 2147483647...原创 2021-03-22 10:20:36 · 31446 阅读 · 0 评论 -
java.lang.IllegalArgumentException: invalid comparison: java.util.Date and java.lang.String
报错原因:<if test="type != null and type != ''"></if>中的type != ''会自动将类型转换为字符串原创 2020-11-25 17:19:20 · 136 阅读 · 0 评论 -
column does not exist
解决方法:双引号改为单引号原创 2020-11-04 15:58:11 · 3140 阅读 · 1 评论 -
concat与concat_ws区别
select concat('大','小') as size from 表查询出结果为:大小select concat('大',NULL) as size from 表查询出结果为:nullconcat中又一个参数为NULL,查出来的就为NULLselect concat_ws('_','大','小','中') as size from 表查询出结果为:大_小_中select concat_ws('_','大','小',NULL) as size from 表...转载 2020-06-19 15:48:14 · 1102 阅读 · 0 评论 -
Mybatis传入参数0 ,会成为空
<if test="sex!=null and sex!=''" > and p.sex = #{sex}</if>当传入sex="0"时,被判断为‘ ’解决方法:改为<if test="sex!=null" > and p.sex = #{sex} </if>...原创 2020-04-30 10:44:34 · 372 阅读 · 0 评论 -
mybatis中批量新增后返回自增的主键id
1.mybatis中insert后返回自增的主键id <insert id="insertSelective" parameterType="pd" useGeneratedKeys="true" keyProperty="drillid"> insert into drill <trim prefix="(" suffix=")" suffixOverri...原创 2020-02-27 16:44:11 · 1345 阅读 · 3 评论 -
判断一条sql语句是否执行成功
通过sql返回值-受影响的行数,判断是否执行成功受影响的行数>=1,执行成功原创 2019-12-13 13:51:31 · 2585 阅读 · 0 评论 -
数据库双机热备实战总结
一、准备工作 1. 准备两台服务器(电脑),接入局域网中,使互相ping得通对方 2. 两台服务器都安装mysql-server-5.6,必须保证mysql的版本一致 3. 假设,服务器A:192.168.1.120,服务器B:192.168.1.121二、 创建同步用户 在主服务器上为从服务器建立一个连接账户,该账户必须授予replication slave权限。...原创 2019-09-02 17:27:01 · 1046 阅读 · 0 评论