Hi guys, I am a newbie with mysql. I am creating tables but i get stuck when it comes to foreign keys. I tried to remove the foreign keys and than paste the rest of the code, add an additional column of the foreign key but still its not working. Could someone assist me please. i will really be grateful.





create table Doctors_Appointment

(Doc_Appointment_Number REFERENCES Patient_Appointment_Number(Doc_Appointment_Number) not null,
Treatment_ID REFERENCES Doctors_Treatment(Treatment_ID)not null))




create table Employee_Appointment

(Employee_ID REFERENCES Employee(Employee_ID)not null,
Doc_Appointment_Number REFERENCES Patient_Appointment(Doc_Appointment_Number)not null))




create table Hospital_Invoice

(Invoice_Number varchar(16)PRIMARY KEY,
Doc_Appointment_Number REFERENCES Patient_Appointment(Doc_Appointment_Number)not null,
Invoice_Date date not null,
Total_Cost decimal(15,2) not null,
Payment_Date date)




create table Payment_Type

(Invoice_Number REFERENCES Hospital_Invoice(Invoice_Number) not null,
Payment_ID REFERENCES Payment(Payment_ID) not null)