跳转至

关联查询

题目

查询岗位级别是经理的员工姓名和工资。

SELECT staff.staff.name ,staff.staff.money FROM staff INNER JOIN positions ON staff.staff.positions_id = positions.positions_id WHERE positions.positions_title = '经理';

查询工资大于12000的员工姓名和岗位级别。

SELECT staff.staff.`name`, staff.staff.money FROM staff INNER JOIN positions ON staff.staff.positions_id = positions.positions_id WHERE staff.staff.money > 12000;

查询工资大于12000的部门名称和岗位?

SELECT staff.section.section_title,staff.positions.positions_title FROM staff.staff INNER JOIN positions ON positions.positions_id = staff.positions_id INNER JOIN section ON section.section_id = staff.section_id WHERE staff.staff.money > 12000;

查询各部门主管的工资是多少,显示部门名称和工资。

SELECT staff.section.section_title, staff.staff.money FROM staff INNER JOIN section ON section.section_id = staff.section_id INNER JOIN positions ON positions.positions_id = staff.positions_id WHERE positions.positions_title = '主管';

查询总经办的男性职工的岗位名称。

SELECT positions.positions_title FROM staff INNER JOIN positions ON positions.positions_id = staff.positions_id INNER JOIN section ON section.section_id = staff.section_id WHERE staff.sex = '男' AND section.section_title = '总经办'