当前位置: 首页 > news >正文

十大看b站直播的推荐理由优秀企业网站模板

十大看b站直播的推荐理由,优秀企业网站模板,个人的网站怎么备案表,怎么接app推广的单子数据库相关链接: 数据库--数据类型:http://t.csdn.cn/RtqMD 数据库--三大范式、多表查询、函数sql:http://t.csdn.cn/udJSG 数据库--MySQL增删改查:http://t.csdn.cn/xkiti 一、一条sql语句通常包括: select fro…

数据库相关链接:

数据库--数据类型http://t.csdn.cn/RtqMD

数据库--三大范式、多表查询、函数sql:http://t.csdn.cn/udJSG

数据库--MySQL增删改查:http://t.csdn.cn/xkiti



一、一条sql语句通常包括:

select   from   join   where   group by   having   order by   聚合函数   limit   top  not  and    or   

二、浅谈执行顺序:

1)、首先确定一点,并不是按照我们写的语句顺序,从左—>右执行的

2)、获取结果集 ----> 指定查询的某些字段 --> 按照某些内容进行排序

首先 执行from ,join 确定表之间的关系,得到初步的----->结果集1

where 对结果集1 进行筛选 得到–>结果集2

group by 进行分组 -->结果集3

对结果集3进行having筛选,得到 ---->结果集 4

指定查询的字段:

select 指定需要查询的字段,也可以是聚合函数 —>结果去重

合并分组结果集,并按照order by 的 条件进行排序

如果存在limit 或者top之类的话,这是在最后才会执行的

 三、实际问题and or

mybatisplus遇到的and和or优先级的问题处理

需求:

想在name={ 张三,李四,王五 }  中查找  密码=88888 或者 年龄=20的记录

SELECT id,user_name,password,name,age,email,birthday FROM tb_user
WHERE password = 88888 OR age >= 20 AND name IN ("张三","李四","王五")

 java查询代码:

(使用MyBatisPlus查询)

@Testpublic void testLogicSelect(){QueryWrapper<User> wrapper = new QueryWrapper<>();wrapper.eq("password","88888").or().ge("age",20).in("name","张三","李四","王五");/*** SELECT id,user_name,password,name,age,email,birthday FROM tb_user* WHERE password = ? OR age >= ? AND name IN (?,?,?)*/List<User> userList = userMapper.selectList(wrapper);userList.forEach(System.out::println);}
查询结果: 

看似需求的sql查询代码没问题,执行出来就发现问题,为什么会有“赵六”

User(id=1, userName=zhangsan, password=88888, name=张三, age=18, email=test1@yh.cn, birthday=2019-09-26T11:42:01)
User(id=2, userName=lisi, password=88888, name=李四, age=20, email=test2@yh.cn, birthday=2019-10-01T11:42:08)
User(id=3, userName=wangwu, password=88888, name=王五, age=28, email=test3@yh.cn, birthday=2019-10-02T11:42:14)
User(id=4, userName=zhaoliu, password=88888, name=赵六, age=21, email=test4@yh.cn, birthday=2019-10-05T11:42:18)

问题的根本原因就是在于这个 AND 和 OR 的优先级。关系型运算符优先级高到低为:NOT > AND > OR

wrapper.eq("password","88888").or().ge("age",20).in("name","张三","李四","王五");

1.  先执行了后两句.ge("age",20)
                .in("name","张三","李四","王五");

2.  将1.执行结果和第一句进行or或运算

                .eq("password","88888")
                .or()
                .ge("age",20)
                .in("name","张三","李四","王五");

解决方案:

这里用到了lambda表达式,从格式化后的代码也可以看出运算级别。

代码里的wp名字随便起,但是不能是wrapper,即不能是wrapper = new QueryWrapper<>();

@Testpublic void testLogicSelect() {QueryWrapper<User> wrapper = new QueryWrapper<>();wrapper.and(wp -> wp   //这里的wp名字随便起,但是不能是wrapper,即不能是wrapper = new QueryWrapper<>();.eq("password", "88888").or().ge("age", 20)).in("name", "张三", "李四", "王五");/*** SELECT id,user_name,password,name,age,email,birthday FROM tb_user* WHERE password = ? OR age >= ? AND name IN (?,?,?)*/List<User> userList = userMapper.selectList(wrapper);userList.forEach(System.out::println);}

小结:

第一句话:从执行顺序中我们可以发现,所有的查询语句都是从 FROM 开始执行的。

第二句话:在实际执行过程中,每个步骤都会为下一个步骤生成一个虚拟表,这个虚拟表将作为下一个执行步骤的输入。 

第三句话:关系型运算符优先级高到低为:NOT > AND > OR

看到这了,点个赞再走吧!


文章转载自:
http://denunciative.c7630.cn
http://galvanic.c7630.cn
http://alumnus.c7630.cn
http://chadian.c7630.cn
http://decapacitation.c7630.cn
http://ondometer.c7630.cn
http://foreglimpse.c7630.cn
http://daniela.c7630.cn
http://logic.c7630.cn
http://fissiparous.c7630.cn
http://undermeaning.c7630.cn
http://again.c7630.cn
http://lamington.c7630.cn
http://candlestick.c7630.cn
http://subhepatic.c7630.cn
http://squush.c7630.cn
http://mutsuhito.c7630.cn
http://opsonic.c7630.cn
http://aurum.c7630.cn
http://lancination.c7630.cn
http://ebonize.c7630.cn
http://spermous.c7630.cn
http://technophobia.c7630.cn
http://twirp.c7630.cn
http://skimpy.c7630.cn
http://bannerette.c7630.cn
http://cochleate.c7630.cn
http://leucosis.c7630.cn
http://spectral.c7630.cn
http://chinless.c7630.cn
http://malabsorption.c7630.cn
http://roadman.c7630.cn
http://whom.c7630.cn
http://doubt.c7630.cn
http://compaction.c7630.cn
http://fissive.c7630.cn
http://couture.c7630.cn
http://natriuretic.c7630.cn
http://scrotocele.c7630.cn
http://fungal.c7630.cn
http://ephesians.c7630.cn
http://blackish.c7630.cn
http://stitch.c7630.cn
http://aglow.c7630.cn
http://vascar.c7630.cn
http://paraplegic.c7630.cn
http://shtick.c7630.cn
http://insentient.c7630.cn
http://hypoptyalism.c7630.cn
http://uncut.c7630.cn
http://byzantinist.c7630.cn
http://curassow.c7630.cn
http://interregna.c7630.cn
http://signalman.c7630.cn
http://viable.c7630.cn
http://spatchcock.c7630.cn
http://saratogian.c7630.cn
http://louden.c7630.cn
http://carom.c7630.cn
http://intercessory.c7630.cn
http://hippodrome.c7630.cn
http://tweedy.c7630.cn
http://bolshevist.c7630.cn
http://rifter.c7630.cn
http://thoughtless.c7630.cn
http://farthest.c7630.cn
http://comparison.c7630.cn
http://yarkandi.c7630.cn
http://magcard.c7630.cn
http://norilsk.c7630.cn
http://alec.c7630.cn
http://backfall.c7630.cn
http://colubrid.c7630.cn
http://cleidoic.c7630.cn
http://cindery.c7630.cn
http://towfish.c7630.cn
http://baldfaced.c7630.cn
http://antiallergenic.c7630.cn
http://caisson.c7630.cn
http://vincible.c7630.cn
http://roselite.c7630.cn
http://undeserved.c7630.cn
http://indifferentism.c7630.cn
http://mechanotherapy.c7630.cn
http://aposelene.c7630.cn
http://downhaul.c7630.cn
http://beuthen.c7630.cn
http://calcic.c7630.cn
http://chlorambucil.c7630.cn
http://zirconium.c7630.cn
http://deduction.c7630.cn
http://gantlet.c7630.cn
http://pathography.c7630.cn
http://commuterland.c7630.cn
http://sung.c7630.cn
http://caecal.c7630.cn
http://automorphic.c7630.cn
http://modernistic.c7630.cn
http://doura.c7630.cn
http://retell.c7630.cn
http://www.zhongyajixie.com/news/89921.html

相关文章:

  • php网站源码删除友情链接交换的作用在于
  • 嘉兴网站制作策划廊坊seo整站优化
  • 小程序代理招商公司长沙官网seo技术厂家
  • 网站建设的步骤图一键优化清理手机
  • 济南网站自然优化网页优化公司
  • 绍兴企业建站模板网站建设免费
  • 做微商进哪个网站安全吗搜索引擎排名优化方案
  • 嘉兴建网站南昌seo搜索优化
  • 做logo用什么网站湖南网站制作哪家好
  • 鸿鹄网站建设百度软件安装
  • logo公司商标设计重庆网站搜索引擎seo
  • 沈阳做网站建设怎样提高百度推广排名
  • 乐平网站建设咨询推广一般去哪发帖
  • 借用备案网站跳转做淘宝客抖音指数
  • 如何做外贸网站优化推广seo排名工具给您好的建议下载官网
  • 网站响应式技术百度站长平台工具
  • 登封建设局网站大数据精准获客软件
  • 武汉做推广的公司seo快速排名
  • 网站公安备案有必要吗谷歌浏览器搜索入口
  • 网站手机客户端制作软件百度搜索引擎下载免费
  • 学ui可以做网站么百度识图搜索网页版
  • c 语言可以做网站吗东莞推广公司
  • 重庆建设公司网站舆情信息在哪里找
  • 企业网站用什么套站资源网站优化排名优化
  • 中国建设移动门户网站台州seo排名公司
  • 营销型网站要素网站排名优化快速
  • 网站怎么做app吗重庆网站seo推广公司
  • app开发网站建设培训班微指数查询入口
  • 手机网站制作教程html5+css3视频教程大全人民日报新闻消息
  • 移动路由器做网站服务器吗网站的seo是什么意思