I need to join three tables in Oracle; I have code but I am not sure if it is totally right.
FROM DISTRICT D1
JOIN EMPLOYEE E1 ON D1.DISTRICT_ID = E1.DISTRICT_ID
JOIN TOTAL_PAB T1 ON E1.EMP_ID = T1.EMP_ID
I need to join the table DISTRICT, EMPLOYEE, AND TOTAL_PAB. Where do the primary and foreign keys go in this join table statement?
- Primary key for EMPLOYEE is EMP_ID and FK is DISTRICT_ID.
- Primary key for DISTRICT is DISTRICT_ID and FK is SUPERINTENDENT_ID.
- Primary key for TOTAL_PAB is PAB_ID and FK is EMP_ID.