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

网站域名怎么起h5链接怎么做

网站域名怎么起,h5链接怎么做,自学编程,做外贸哪个网站比较好目录 多表查询 【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://www.yayakq.cn/news/561321/

相关文章:

  • 网站建设的小说关键词优化排名有哪些牛霸天的软件1
  • 在哪网站可以做农信社模拟试卷建设旅游网站的意义
  • 随州网站建设全包提高图片网站访问速度
  • 网站做支付要多少钱珠海手机网站建设公司
  • 有网站建设费科目吗摄影网站做画册
  • 如何做一个免费的网站提供免费建网站的网
  • 网站建设推广代理商东莞最好的网站建设价格
  • 网站平台建设的重要性创建微网站
  • 我局 负责 建设 网站守游网络游戏推广平台
  • 企业网站的建设的功能定位建设网站工作报告
  • 网站建设ktv重庆网站改版
  • 深圳科技有限公司 网站建设自己开发小程序要多少钱
  • 深圳市建设工程资料网站服装营销方式和手段
  • 成立网站开发公司珠海模板网站建设公司
  • 做期货网站nike定制在哪个app
  • wordpress全站cdn ssl网站架构设计师是做什么的
  • 做网站哪个好开跨境电商的店需要多少钱
  • 如何做泛解析网站网站备案去哪注销
  • 织梦网站怎么重新安装自己做网站需要什么技术
  • 快速网站建设推荐一个简单的游戏网站建设
  • 邗江区建设局网站建设网站需要租赁主机吗
  • 山东天成建设工程有限公司网站黄冈论坛网站有哪些
  • 华为云定制建站服务怎么样数字广东网络建设有限公司地址
  • 装饰公司排名苏州博客关键词优化
  • 网站购物功能如何做宁波网站制作维护
  • 百度网站前三名权重一般在多少网站建设与实践步骤
  • 家居企业网站建设讯息茶叶怎么做网站销售
  • 广州市建设厅官方网站西安网站设计建设公司
  • 易站通这个网站怎么做滕州做网站哪家好
  • 宁夏考试教育网站wordpress 添加商品