查询中国用户中男性的信息以及外国用户中年男性的用户信息
select id,cname,csex from t_ca where csex=‘男’
union
select t_id,tname,tgender from t_ua where tgender='male';
特点:
1.要求多条查询语句的查询列数是一致的
2.要求多条查询语句的查询的每一列的类型和顺序最好是一致的。
3.union 关键字默认关键字去重,如果使用union all可以包含重复项。
查询中国用户中男性的信息以及外国用户中年男性的用户信息
select id,cname,csex from t_ca where csex=‘男’
union
select t_id,tname,tgender from t_ua where tgender='male';
特点:
1.要求多条查询语句的查询列数是一致的
2.要求多条查询语句的查询的每一列的类型和顺序最好是一致的。
3.union 关键字默认关键字去重,如果使用union all可以包含重复项。