设为首页 加入收藏

TOP

mysql(七)
2019-09-17 19:01:23 】 浏览:44
Tags:mysql

多表查询:

  显示内连接:

    select 字段列表 from 表名1  inner  join 表名1 on  条件 

    * inner 可忽略

    select * from student inner  join  class on student.clas_id=class.id

  隐式内连接:

    使用where:

      select  t1.name,t2.name from student t1,class  t2 where t1.class_id=t2.id

  外连接:

    左外链接

    右外链接

    *outer一般忽略

    select * from student left  join outer class on student.clas_id=class.id

子查询:

   select *from student where class_id = (select max(class_id) from student)

   select *from student where class_id in (select id from student where id=2 or id =3)

   select *from student  t1 ,(select *from class where class.id>2) where t1.class_id=t2.id

 

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇大数据学习(一)-------- HDFS 下一篇MySQL mysqlbinlog 读取mysql-bin..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目