1.员工表(emp_employeeemp)字段:name,age,genderFlag,department

2.性别(维护)表pub_gender_info,字段genderFlag,genderName

查询员工数>10的部门的所有员工信息(姓名,年龄,部门,性别)

select name,age,genderName from
emp_employee emp,pub_gender_info pub where
emp.genderFlag=pub.genderFlag and department in (
select department from emp_employee
group by department having count(*)>10
);

之前做过的一个面试题。性别单独维护在一个表中,没有实际意义。考察两个表的关联。