Oracle:从两个表中选择

时间:2016-02-17 09:02:31

标签: oracle10g

我有两张表EMPLOYEEDEPARTMENT

DEPARTMENT表的列:

 DEPARTMENT_ID
 DEPARTMENT_NAME
 MANAGER_ID
 LOCATION_ID

EMPLOYEE

的列
EMPLOYEE_ID
FIRST_NAME
LAST_NAME
EMAIL
PHONE_NUMBER
HIRE_DATE DATE
JOB_ID
SALARY
COMMISSION_PCT
MANAGER_ID
DEPARTMENT_ID

如果显示所需的号码DEPARTMENT_ID,请选择EMPLOYEE_ID

FIRST_NAME
LAST_NAME
EMAIL
PHONE_NUMBER
HIRE_DATE DATE
JOB_ID
SALARY
COMMISSION_PCT
MANAGER_ID
DEPARTMENT_ID

1 个答案:

答案 0 :(得分:1)

请执行此查询

select 
    emp.first_name, emp.last_name, emp.email, emp.phone_number, 
    dept.manager_id 
from 
    employee emp, department dept 
where 
    emp.department_id = dept.department_id