想对一张表进行查询，满足任意一个条件即可，可以用union实现或查询。
```id
age
gender
1
20
female
2
21
male
3
22
male```

比如说person表中满足年龄超过20岁的女性或者年龄超过22岁的男性，才可以结婚。我们用if这样写
```1
if(person.age > 22 || (person.age > 20 && person.gender == "female"){
2
System.out.println("达到法定要求准许结婚！");
3
}

1
select * from person p where p.age > 22
2
union select * from person p where p.age >20 and p.gender = "female";```

```1
(select * from person p where p.age > 22)
2
union
3
(select * from person p where p.age >20 and p.gender = "female")
4
order by age limit 10;```

```1
select count (*) from
2
(select * from person p where p.age > 22
3
union select * from person p where p.age >20 and p.gender = "female");```

```1
select sum (cnt) from
2
(select count(*) as cnt from person p where p.age > 22
3
union select count(*) as cnt from person p where p.age >20 and p.gender = "female");```

```1
select count (*) from
2
(select * from person p where p.age > 22
3
union select * from person p where p.age >20 and p.gender = "female")as total;
1
select sum (cnt) from
2
(select count(*) as cnt from person p where p.age > 22
3
union select count(*) as cnt from person p where p.age >20 and p.gender = "female") as total;
```