当前位置:网站首页>mysql数据库,oracle数据库中对字段的拼接方法
mysql数据库,oracle数据库中对字段的拼接方法
2022-04-21 18:41:00 【薄荷味脑花】
mysql数据库,oracle数据库中对字段的拼接方法
1.简介
在日常开发中,常常有将多个字段拼接进行sql操作的场景,比如做模糊查询,我这里分两种环境阐述:1.在数据库中的写法;2.在mybatis或mybatisplus中的写法
2.在数据库中的写法:
mysql:
//mysql可以直接拼接
select * from goods where goods.name like "%瓦%";
//mysql中有专门的拼接函数concat,注意concat在mysql中可以有两个以上的参数!但在oracle中只能最多两个参数!
select * from goods where goods.name like concat("%",“瓦","%");
oracle:
//oracle可以直接拼接,但必须使用 ||
select * from goods where goods.name like '%' || '瓦' || '%';
//oracle中也提供了concat函数,但参数最多两个
select * from goods where goods.name like concat('%','瓦%');
3.在mybatis或mybatisplus中:
mysql 和 oracle 都可以使用${}和#{}注入,
like '%' || #{goods.name} || '%'
like '%${goods.name}%'
like concat("%", #{goods.name},"%");
like concat("%", '${goods.name}',"%");
版权声明
本文为[薄荷味脑花]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_41657954/article/details/124250003
边栏推荐
- Single case model of hand tear
- Can we find the next "cheese stick" product in the 2022 Q1 financial report of miaolando?
- AVL平衡二叉树及其4种旋转方式
- 干货|app自动化测试之Appium WebView 技术原理
- Advanced formula 47 of C language: recursive function analysis
- 开发者工具 Top 100 名单
- Developer tools top 100 list
- Redis-benchmark性能测试工具使用详解
- A simple and easy-to-use file upload scheme
- 2021-5-1 第一天第一题
猜你喜欢

CVPR2022 Oral | 多模态学习中的贡献不平衡问题

The Renaissance of digital art, the exploration and rise of Digital Collections
![[network] summary of 4G and 5g frequency bands](/img/54/36b963dd968eb4ef8b20b58ffea376.png)
[network] summary of 4G and 5g frequency bands
WeChat QQ Alipay three in one payment two-dimensional code implementation principle

妙可蓝多的2022年Q1财报中,能否发现下一个“奶酪棒”产品?

序列化对象+Properties+IO框架

MySQL数据库学习---第六章多表查询的课后习题

Target penetration exercise 78 Thoth Tech

Target penetration exercise 76-dc8

单例模式你不得不知道的底层原理
随机推荐
Which immortal wrote 421 pages of advanced notes on MySQL, covering all MySQL technologies! It's so sweet
Does qiniu business school need money to open a securities account? Is it safe?
使用chrome的replay功能快速地发表一遍blog
The products that were once bought are coming again. It must be right to buy them steadily
win10 uwp InkCanvas控件数据绑定
Target penetration exercise 70-dc2
图文并茂 教你在IDEA中如何一键生成代码,提高开发效率!
干货|app自动化测试之Appium 源码修改定制分析
Don't look for it. This is the clearest article on microservices so far! No one
matlab:e的计算方法
Huawei level 18 Daniel collates and summarizes: microservice design and distributed service framework principle practice document
Question 1 on the first day of May 1, 2021
OBS接入网络摄像机
Target penetration exercise 73-dc5
Target penetration exercise 74-dc6
如何查看redis源码中的 zskiplist 结构
MySQL安装的初始密码在哪看?
ArrayList && { }
How about qiniu securities account app? Who opened an account? Is it safe?
Tencent cloud database tdsql -- blog database migration practice