Question: In Oracle SQL, I already have an Employee table with Emp_SSN as its primary key, and a Patient table with Pat_SSN as its primary key.




In Oracle SQL, I already have an Employee table with Emp_SSN as its primary key, and a Patient table with Pat_SSN as its primary key.
I want to create a child table called Patient_Employee to relate patients to the employees that care for them.
I am trying to use the foreign keys, Emp_SSN from the Employee table, and Pat_SSN from the Patient table, as a composite primary key in the new Patient_Employee table. I cant get it to work..
ive attached pics of the tables, and a pic of the errors im getting when trying to compile the new Patient_Employee table.
Can someone please show me the proper syntax to get this to work (specifically using Oracle SQL syntax)?
CREATE TABLE Employee ( Emp_SSI number (9) HOT HULL, Dept Name varchar (25) Emp First Name varchar (15), Emp Last Name varchar (15), Hire Date DATE, Emp Phone nunber (15), Emp Street Address varchar (25) Emp City varchar (15), Emp State varchar (15), Job Title varchar (15), Emp Birth Date DATE, CONSTRAINT Employee_PK PRIMARY KEY (EMP_SS) CONSTRATNT Department FK FOREIGN KEY (Dept Name) REFERENCES Departaent (Dept Hane) INSERT INTO Employee VALUES (111iiil, '24 Hour Euergency', 'Bob, 'Harley, TO DATE (2017-03-03, TTTY//DD', 4049995555, '123 s 'Atlanta 'Georgia', 'Physician', TO DATE ('1983-12-06', 'Ym/DD')): IHSERT DSTO Eaployee VALUES (222222222, 'clinic/Lab', 'Hark', 'Jones', TO_DATE( 2014-12-04, TTEY/M/DD'1, 7709897683, '456 N. Valley Rd. ' Atlanta', 'Georgia', 'Nurse', TO DATE ( '1992-01-13', 'TYYY/II/DD')): IHSERT INTO Eaployee VALUES (333333333, 'Patient Administration', Sara', 'Hazel', TO DATE ( '2018-04-11, 'TTI//DD'), 4045451243, 134 N. Bear 'Hazel' Marietta', 'Georgia', 'Adninistrator', TO DATE ( '1979-06-o1', TTY/MI/DD ')): INSERT INTO Employee vALUES (444444444, 'General Services', 'Dave', Thomas' TO DATE ( 2018-10-22 TT/D, 6783836745, 147 Main 3t. 'YYYY/MM/DD" ) ) ; Adans Georgia, ' Contractor , T0-DATE ( 1990-08-03' , Atlanta , , DATE (2014-05-13, 4-05-13'YTMDD), 4709873491, '4929 Market mmm/DD"), 4709873491, .4929 Harket Sq INSERT INTO Employee VALUES (555555555, 'General ervices', 'John' Decatur, Georgia', 'Sec ral services", John", . TO urity', TO DATE ( 1980-09-27, TTYY/M/DD') SELECT FRO2t Employee
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
