Mysql:union 并集
示例:从user表中查年级大于16 或者性别为女的人员姓名
select name from user where age>16 or sex='女'
若在查询中使用or 可能会导致索引失败 使用union 即可 如:
select name from user where age>16
union
select name from user where sex='女'
注意 union需要注意的条件:
使用union 列需要有相同属性的列,相同数量的列,同时每条select语句查找的各个字段顺序需要一致