联合查询使用关键子union,用于在多个表种查询信息,并且信息类型相同的查询!
union 关键子用于联合查询
如:
(select *from student where student.score>10 limit 1)
union all
(select * from student where student.address = '湖北' limit 1)
union 可选为all和distinct
all选项表示不去掉重复的记录
distinct表示去掉重复的记录
联合查询使用关键子union,用于在多个表种查询信息,并且信息类型相同的查询!
union 关键子用于联合查询
如:
(select *from student where student.score>10 limit 1)
union all
(select * from student where student.address = '湖北' limit 1)
union 可选为all和distinct
all选项表示不去掉重复的记录
distinct表示去掉重复的记录