表连接

1、select * from student,score ——笛卡尔积

2、两个表的连接:

法1:select student.sno, sname, degree

from student,score  ----当查询的列名两个表中都有时要在列名前面加上‘表名.’

where student.sno=score.sno

法2:select cno, (select sname from student where student.sno=score.sno),degree from score

法3:select student.sno ,sname,cno,degree

from student join score     --- //inner join(默认) //left join(以左表为主表)  //right join(以右表为主表)

on student.sno=score.sno

3、三个表的连接

法1:

select student.sno, sname, cno, degree, name     ---注:select student.sno, sname, cno, degree+10, name+‘同学’ 结果是:成绩增加10分,名字后面加上同学

from student,score,course  ----当查询的列名不只存在1个表中都有时要在列名前面加上‘表名.’

where student.sno=score.sno

and   score.cno=course.cno

法2:select student.sno, sname, cno, degree, name

from student join score

on student.sno=course.sno

join course

on score.cno=course.cno

4、纵链接

最新文章

  1. CSS3 波浪简单模拟--我是波浪,我有起伏,有大波与小波(坏笑中...)
  2. C#基础:委托
  3. R12.2 URL Validation failed. The error could have been caused through the use of the browser's navigation buttons
  4. 李洪强iOS开发之【零基础学习iOS开发】【01-前言】01-开篇
  5. 一个HR给应届毕业生的面试建议 后悔看到的太晚了 (转)
  6. 在YII中使用Redis等缓存
  7. 利用eclipse新建的java web项目没有部署描述符web.xml文件怎么办?
  8. PHP学习笔记六【方法-递归】
  9. [ext4]空间管理 - 与分配相关的关键数据结构
  10. Hibernate学习---Configuration,Session,SessionFactory
  11. JIRA 7.8 版本的安装与破解
  12. IIS发布ASP.NET Core
  13. python入门(十五):装饰器
  14. 个人作业 - Week3 - 案例分析
  15. jenkins X实践系列(2) —— 基于jx的DevOps实践
  16. Android notifyDataSetChanged
  17. linux处理U盘中的资料-挂载-tar.gz软件安装-linux环境下软件的安装方式
  18. swoole集群 nginx配置
  19. JNI概述
  20. 【BZOJ2969】矩形粉刷 概率+容斥

热门文章

  1. Javascript 继承 图形化展示
  2. Linux编程之PING的实现
  3. Redis 提供的好的解决方案 实例
  4. jQuery 学习总结(上)
  5. CentOS 7 网卡命名修改为ethx格式
  6. JavaScript易混淆知识点小回顾--数组方法与字符串方法;
  7. 一口一口吃掉Volley(一)
  8. git文件夹下项目更改ip地址小结
  9. 图片转换PDF
  10. click延时300ms的故事