Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
Input: CREATE TABLE Patient (P_ID NUMBER (4), P_EName VARCHAR2 (30), P_LNAME VARCHAR2 (20), ParentID NUMBER (4), Condition VARCHAR2 (30), PRIMARY KEY (P_ID, ParentID), POREIGN KEY
Input: CREATE TABLE Patient (P_ID NUMBER (4), P_EName VARCHAR2 (30), P_LNAME VARCHAR2 (20), ParentID NUMBER (4), Condition VARCHAR2 (30), PRIMARY KEY (P_ID, ParentID), POREIGN KEY (ParentID) REFERENCES Parent ON DELETE CASCADE); CREATE TABLE Appointment (Appointment ID NUMBER (4), ParentID NUMBER (4), P_ID NUMBER (4) AptTime DATE, Apt Date DATE, AptComment VARCHAR2 (30), StaffID NUMBER (4), PRIMARY KEY (AppointmentID, OwnerID, StaffID, PetID), FOREIGN KEY (ParentID) REFERENCES Parent ON DELETE CASCADE, FOREIGN KEY (StaffID) REFERENCES Staff ON DELETE CASCADE, POREIGN KEY (P_ID) REFERENCES Patient ON DELETE CASCADE); Output: ORA-02256: number of referencing columns must match referenced columns 02256. 00000 - "number of referencing columns must match referenced columns *Cause: The number of columns in the foreign-key referencing list is not equal to the number of columns in the referenced list. Make sure that the referencing columns match the referenced columns. *Action: When I run the code, it always returns an error. There are four tables, with the other two containing only the primary key. When I remove foreign keys for parentID and P_ID it works fine. What is the right way to write the code to create the table appointment
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started