基本语法:左表 [inner] join 右表 on 左表.字段 = 右表.字段;
on表示连接条件: 条件字段就是代表相同的业务含义(如my_student.c_id和my_class.id)
当两个表中存在相同意义的字段的时候...其中union选项有两个选项可选
all:表示无论重复都输出
distinct: 去重(整个重复)(默认的)
select *from addr
union all
select *from addr...;
select id,addrid
from addr
union all
select id,addrid
from student;
联合查询只要求字段一样, 跟数据类型和顺序无关
select...id,addrid,sex,score
from student
union all
select sex,addrid,id,score
from student;
联合查询的意义:...联合查询order by的使用
在联合查询中: order by不能直接使用(不能出现两次),需要对查询语句使用括号才行;
select *from student
where sex="woman