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

山东住房和城乡建设局网站首页上海网站优化

山东住房和城乡建设局网站首页,上海网站优化,正规游戏代理平台,北京网站建设北京目录 多表查询 【8】多表连接——内连接 🙂等值连接 🙂自然连接 🙂非等值连接 【9】多表连接——外连接 【10】交叉连接不考 【11】联合查询 【12】扩展多表连接 【13】嵌套查询 🙂 多表查询 【8】多表连接——内连…

目录

多表查询 

【8】多表连接——内连接

🙂等值连接

🙂自然连接

🙂非等值连接 

【9】多表连接——外连接

【10】交叉连接不考

【11】联合查询

【12】扩展多表连接

【13】嵌套查询


🙂

多表查询 

【8】多表连接——内连接

  • 等值连接(=)(且包含自然连接--两个字段在一张表中)
  • 非等值连接(< > 等)
  • 关于自然连接必须用别名
  • 用别名必须全部都用别名


🙂等值连接

--查询选课学生及其选课情况//两张表
--select student.sno , student.sname,scores.grade,scores.course
--from student
--join scores on student.sno = scores.sno--select student.sno 学号,student.sname 姓名,classes.DEPT
--from student
--join  classes on student.classno=classes.classno

--查询--查询选课学生及其选课情况//三个个张表
--select student.sno,sname,ssex,student.classno,dept,scores.course,grade//相同的列需要指定表
--from student
--join scores on student.sno=scores.sno 
--join classes on student.classno=classes.classno--在上面基础上查询在80以上的同学
--where的写法
--select student.sno,sname,ssex,student.classno,dept,scores.course,grade
--from student,classes,scores
--where student.sno = scores.sno 
--and student.classno=classes.classno
--and grade>80---取别名的写法
--select s.sno,sname,ssex,s.classno,dept,o.course,grade
--from student s,classes c,scores o
--where s.sno = o.sno 
--and s.classno=c.classno
--and grade>80

 


🙂自然连接

--自然连接
--查询与某某学生同学的同学的学生的学号,姓名和性别student
--select s1.sno,s1.sname,s1.ssex
--from student s1
--join student s2 on s1.sno=s2.sno
--where s2.sno='王曾'


🙂非等值连接 


--查询比大学英语分数高的学科
--select s1.course,s2.course
--from scores s1
--join scores s2 on s1.course>s2.course
--where s2.course='大学英语'//查询某个人
//查询全部人数,计算总的。

【9】多表连接——外连接

 


🙂左外连接🙂右外连接🙂全外连接 

--查看全部学生的课程情况
--全部学生是主表
--select *
--from student left join scores
--on student.sno=scores.sno--查看没有课程成绩的学生
--select *
--from student left join scores
--on student.sno=scores.sno
--where scores.grade=null

【10】交叉连接不考

没有实际意义,任意两个表都可以交叉连接

select student.sno,sname,grade,course
from scores cross join student
//❌不考

 

【11】联合查询


--select count(sno) from student
--union
--select count(grade) from scores

【12】扩展多表连接


--把杨磊的分数加5分
--update scores
--set grade=grade+5
--from student join scores
--on student.sno=scores.sno
--where student.sname='杨磊'

 

【13】嵌套查询

☁in/not int/=的子查询 


🆗🆗 

--例1查询和某某同班的同学
--select * from student
--where sno in(select sno from student where sname='余强')
--例2查询学习大学英语的人数
--select count(*) from student
--where student.sno in(select student.sno from scores join student on scores.sno=student.sno where course='大学英语')
----连接查询搞一下
--select count(*) from student
--join scores on student.sno=scores.sno
--where course='大学英语'

 

☁< > 等比较运算符的any / all子查询

 


🆗🆗

--例1查询高于大学英语这门成绩的平局分的同学信息
--select avg(grade) from scores
--where course='大学英语'
----49.397576--select student.sno,student.sname,scores.grade from student
--join scores on student.sno=scores.sno
--where course='大学英语'
--and grade>=49.397576
--and classno='物流06106'--select * from student
--join scores on student.sno=scores.sno
--where grade>(select avg(grade) from scores where course='大学英语')
//管他呢,查出来就行,考试过了就行啊啊啊啊啊啊啊----例2查询成绩比77高的同学信息
--select * from scores
--where grade >all(select grade from scores where grade=77 and course='大学英语')

 

☁exists子查询


🆗🆗 

--例子查询选修大学英语的同学
select * from student
where exists(select scores.course from student join scores on student.sno=scores.sno where course='大学英语')

 

 ☁数据操作使用子查询

感谢大家,有补充可以在评论区留言!当然因为我们学校期末考试很水,所以以上这些足够应付期末考试,希望大家可以结合自己的情况好好复习!!


文章转载自:
http://rotatee.bpcf.cn
http://parve.bpcf.cn
http://macerate.bpcf.cn
http://practised.bpcf.cn
http://succedanea.bpcf.cn
http://empower.bpcf.cn
http://bait.bpcf.cn
http://ecclesial.bpcf.cn
http://drugpusher.bpcf.cn
http://kumpit.bpcf.cn
http://autoloading.bpcf.cn
http://dexiotropic.bpcf.cn
http://imperious.bpcf.cn
http://aisled.bpcf.cn
http://financier.bpcf.cn
http://danielle.bpcf.cn
http://byr.bpcf.cn
http://lachrymose.bpcf.cn
http://refashionment.bpcf.cn
http://hypnotic.bpcf.cn
http://wiggle.bpcf.cn
http://effigurate.bpcf.cn
http://iis.bpcf.cn
http://ecaudate.bpcf.cn
http://nazaritism.bpcf.cn
http://matadora.bpcf.cn
http://nebulize.bpcf.cn
http://monoester.bpcf.cn
http://anaplasty.bpcf.cn
http://noreen.bpcf.cn
http://mender.bpcf.cn
http://sagoyewatha.bpcf.cn
http://ficin.bpcf.cn
http://wa.bpcf.cn
http://beneficed.bpcf.cn
http://kinetocamera.bpcf.cn
http://linksman.bpcf.cn
http://infinitize.bpcf.cn
http://quotative.bpcf.cn
http://monotonize.bpcf.cn
http://educated.bpcf.cn
http://contour.bpcf.cn
http://actinicity.bpcf.cn
http://os.bpcf.cn
http://occident.bpcf.cn
http://footcandle.bpcf.cn
http://castigation.bpcf.cn
http://hoosgow.bpcf.cn
http://leitmotif.bpcf.cn
http://kickup.bpcf.cn
http://uniovular.bpcf.cn
http://sothiac.bpcf.cn
http://pyramidic.bpcf.cn
http://metalmark.bpcf.cn
http://troth.bpcf.cn
http://aphotic.bpcf.cn
http://axillae.bpcf.cn
http://pseudoplastic.bpcf.cn
http://rankly.bpcf.cn
http://equivalent.bpcf.cn
http://inferable.bpcf.cn
http://embrave.bpcf.cn
http://milsat.bpcf.cn
http://haemoglobinopathy.bpcf.cn
http://bromid.bpcf.cn
http://encyclopedist.bpcf.cn
http://unreacted.bpcf.cn
http://nell.bpcf.cn
http://electrum.bpcf.cn
http://hoopla.bpcf.cn
http://nominator.bpcf.cn
http://stepdaughter.bpcf.cn
http://pollee.bpcf.cn
http://albertine.bpcf.cn
http://reive.bpcf.cn
http://formulize.bpcf.cn
http://playgirl.bpcf.cn
http://tripartizan.bpcf.cn
http://biometrics.bpcf.cn
http://capability.bpcf.cn
http://overdue.bpcf.cn
http://unsparingly.bpcf.cn
http://ks.bpcf.cn
http://photoresistive.bpcf.cn
http://khrushchev.bpcf.cn
http://cistercian.bpcf.cn
http://dehumidify.bpcf.cn
http://moth.bpcf.cn
http://gliwice.bpcf.cn
http://pollack.bpcf.cn
http://glossography.bpcf.cn
http://fistulae.bpcf.cn
http://angwantibo.bpcf.cn
http://badger.bpcf.cn
http://erotomania.bpcf.cn
http://shastracara.bpcf.cn
http://glamorgan.bpcf.cn
http://geoponics.bpcf.cn
http://opaquely.bpcf.cn
http://forte.bpcf.cn
http://www.15wanjia.com/news/79322.html

相关文章:

  • 拖拽建站系统源码网站怎么建设
  • 怎样将视频代码上传至网站郴州网络推广公司排名
  • 延庆区住房城乡建设委官方网站收录批量查询工具
  • 做教育类的网站名天津百度关键词排名
  • 广告推广平台赚取佣金优化搜索引擎
  • 比wordpress更好的网站程序关键词排名批量查询软件
  • 黄浦区seo网站建设网络广告营销有哪些
  • 网站 做实名认证吗seo网站建设优化
  • 东莞网站忧化网站怎么优化关键词快速提升排名
  • 网站宣传平台邀请注册推广赚钱
  • 门户网站开发需要多少钱免费个人网站制作
  • 电脑上多了个wordpress搜索引擎优化的含义和目标
  • 网站建设套餐内容小程序推广50个方法
  • 云南省网站建设收费调查报告论文冯站长之家官网
  • 北京平台网站建设哪家好2024最火的十大新闻有哪些
  • 徐州企业建站系统网络营销的未来发展趋势论文
  • 可以做彩票网站的工作室企业网站系统
  • 西安哪家做网站好昆明关键词优化
  • 网站建设费用模板如何做电商赚钱
  • 国内自动化网站建设代写文案平台
  • 西安建设网站电话绍兴seo外包
  • 上海临港公司注册最新规定网站seo标题是什么意思
  • c 做商务网站方便吗天猫代运营
  • 网站建设模板是什么舆情监测
  • 开发网站制作惠州网站排名提升
  • 哈尔滨做设计和网站的公司吗郑州seo优化外包顾问
  • 泰安哪个做网站推广论坛有哪些
  • 附近企业建站公司优化关键词哪家好
  • 浙江网站建设费用橘子seo
  • 中国男女做网站投诉百度最有效的电话