
MySQL
南宫佑
扎瓦,我是认真的。
展开
-
mysql
UPDATE 后面接SELECT的用法 update facility_info set facility_num = 1 where create_time = ( select a.create_time from (select min(create_time) as create_time from facility_info) a); select id,name,facility_...原创 2020-01-08 16:32:22 · 165 阅读 · 2 评论 -
mabatis入参
入参为List的写法: Mapper 文件的写法: select id from static where id in #{item} 其中这个标签是用来循环传入的集合的,collection="list"这个参数中有list,map两种,还有就是自定义的参数,item="item"这个参数可以自定义,用来循环集合里面的值,这个参数的取名要和下面#()这个里面的取...原创 2019-10-21 10:15:20 · 162 阅读 · 0 评论 -
MyBatis高级
一对一查询: 1.resultType进行实现: 执行的sql语句: 查询的主表:订单表 查询的关联表:用户表 orders表有一个外键 select orders.*,user.username,user.sex,user.address from orders ,user where orders.user_id = user.id; ordersCustomer.java 复制代码 pub...原创 2019-10-19 10:14:46 · 160 阅读 · 0 评论 -
Mysql中concat,concat_ws , group_concat的用法
一、concat()函数 1、功能:将多个字符串连接成一个字符串。 2、语法:concat(str1, str2,…) 返回结果为连接参数产生的字符串,如果有任何一个参数为null,则返回值为null。 3、举例: 例1:select concat (id, name, score) as info from tt2; 中间有一行为null是因为tt2表中有一行的score值为null。 例2:在...原创 2019-10-14 18:13:19 · 202 阅读 · 0 评论 -
Mybatis动态SQL Where 1 = 1
我们在使用 Mybatis 框架编写 SQL 语句时,会发现这个现象 select from t_people where 1=1 and bookName = #{bookName} and author = #{author} 发现这个 select 查询语句中存在一条这样的语句 wh...原创 2019-10-12 15:36:45 · 1238 阅读 · 0 评论 -
MySQL 动态sql
今天,主要学习MyBatis的动态SQL。这是MyBatis的强大特性之一。 动态SQL的作用 MyBatis的动态SQL主要就是为了解决手动拼接SQL的麻烦 动态SQL中的元素 动态SQL是MyBatis的强大特性之一,MyBatis3采用了功能强大的基于OGNL的表达式来完成动态SQL。动态SQL主要元素如下表所示: 1. 元素 在MyBatis中,元素是最常用的判断语句,它类似于Java中的...原创 2019-10-10 16:54:13 · 840 阅读 · 0 评论