select e.last_name,d.department_id,d.department_name from employees e,departments d where(e.department_id=d.department_id);
2. 查询90号部门员工的job_id和90号部门的location_id
select e.job_id,d.location_id from employees e,departments d where e.department_id=d.department_id and d.department_id=90;
3. 选择所有有奖金的员工的
last_name , department_name , location_id , city
select e.last_name,d.department_name,l.location_id,city from employees e,departments d,locations l
where e.department_id=d.department_id and d.location_id=l.location_id
and commission_pct isnotnull;
4. 选择city在Toronto工作的员工的
last_name , job_id , department_id , department_name
select e.last_name,e.job_id,d.department_id,d.department_name from employees
e,departments d,locations l
where e.department_id=d.department_id and d.location_id=l.location_id and l.city='Toronto';
5. 选择指定员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式
employees Emp# manager Mgr#
kochhar 101 king 100select e.employee_id "employees",e.last_name "Emp#",d.manager_id "Mgr#",d.last_name
"manager"from employees e,employees d where e.manager_id=d.employee_id(+);