专注于 JetBrains IDEA 全家桶,永久激活,教程
持续更新 PyCharm,IDEA,WebStorm,PhpStorm,DataGrip,RubyMine,CLion,AppCode 永久激活教程

Mysql(连接查询)

1、等值连接与非等值连接

当连接运算符为等号时为等值连接,当为其他运算符时为非等值连接。

    select studentno,sname                 
    from student,teach_class,teacher
    where student.classno=teach_class.classno
    and teach_class.teacherno=teacher.teacherno
    and teacher.tname='刘老师'

2、自身连接

连接操作发生在一个表以其自身进行连接。

select teacher.*
from teach_class t1,teach_class t2,teacher 
where  t1.teacherno=teacher.teacherno
and t2.teacherno=teacher.teacherno
and t1.courseno='c1'
and t2.courseno='c2'

3、外连接

在连接操作中被舍弃的元组成为“悬浮元组”。

左外连接:只保留左边关系的悬浮元组。

右外连接:只保留右边关系的悬浮元组。

select course.*
from course left outer join score on (course.courseno=score.courseno)
where score.studentno is null

4、嵌套查询

ANY:某个值

ALL: 所有值

select studentno,sname,classno
from student s1
where point>(
select AVG(point)
from student s2
where s1.classno=s2.classno
)

文章永久链接:https://tech.souyunku.com/22436

未经允许不得转载:搜云库技术团队 » Mysql(连接查询)

JetBrains 全家桶,激活、破解、教程

提供 JetBrains 全家桶激活码、注册码、破解补丁下载及详细激活教程,支持 IntelliJ IDEA、PyCharm、WebStorm 等工具的永久激活。无论是破解教程,还是最新激活码,均可免费获得,帮助开发者解决常见激活问题,确保轻松破解并快速使用 JetBrains 软件。获取免费的破解补丁和激活码,快速解决激活难题,全面覆盖 2024/2025 版本!

联系我们联系我们