共有三个可用的表和列:
Core - EmpID, EmpName
1, Yagga Boshu
External - ExternalEmpID, ExternalDeptName
1 , Capegemini
Position - EmpID, Dept P/S
1, IT Primary
1, Finance Secondary
我想从以下格式创建视图:
Emp ID, EmpName, ExternalID, ExternalName, EmpPrimaryDept, EmpSecondaryDept
1, Yagga Boshu, 1 , CapeGemini , IT, FINANCE
- EmpID 和 EmpName 来自 Core Table。
- ExternalID 和 ExternalName 来自于具有核心表的 OneToOne 的外部表
- EmpPrimaryDept 和 EmpSecondaryDept 来自具有核心表的 OneToMany 位置表
对于 1) 和 2) 以下查询有效:
select * from CORE ec, EXTERNAL ee
where ec.EMPLOYEEID = ee.ExternalEmpID
如何加入 Position 表,以便如上所述返回一行?
- 核心中有 20,000 名员工数据。
- 在您看到 1 Emp ID 的问题中,它们是两个表之间的链接。
- 我正在使用 Oracle Database 12c 版本 12.1.0.1.0 - 64 位生产