



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Entity Relationships Excercises include Patients,Payment,Appointment,Doctor,Bill,Medical and Specialist.
Typology: Exercises
1 / 7
This page cannot be seen from the preview
Don't miss anything!
CREATE TABLE Doctor( Doctorid INTEGER, Name VARCHAR(30), Dob DATE, Address VARCHAR(50), Phoneno VARCHAR(20), Salary NUMERIC(20,2), CONSTRAINT PKDoctor PRIMARY KEY (Doctorid) )
CREATE TABLE Medical( Doctorid INTEGER, Overtimerate NUMERIC(4,2), CONSTRAINT PKMedical PRIMARY KEY (Doctorid), CONSTRAINT FKMedical FOREIGN KEY (Doctorid) REFERENCES Doctor(Doctorid) ON DELETE CASCADE )
CREATE TABLE Specialist( Doctorid INTEGER, Fieldarea VARCHAR(30), CONSTRAINT PKSpecialist PRIMARY KEY (Doctorid), CONSTRAINT FKSpecialist FOREIGN KEY (Doctorid) REFERENCES Doctor(Doctorid) ON DELETE CASCADE )
CREATE TABLE Patient( Patientno INTEGER, Name VARCHAR(40), Address VARCHAR(50), PhoneNo VARCHAR(20), Dob DATE, CONSTRAINT PKPatient PRIMARY KEY (Patientno) )
CREATE TABLE Payment( Paymentno INTEGER, Details VARCHAR(60), Method VARCHAR(20), Patientno INTEGER, CONSTRAINT PKPayment PRIMARY KEY (Paymentno), CONSTRAINT FKPayment FOREIGN KEY (Patientno) REFERENCES Patient(Patientno) )
CREATE TABLE Bill( Billno INTEGER, Total NUMERIC(10,2), Doctorid INTEGER, CONSTRAINT PKBill PRIMARY KEY (Billno), CONSTRAINT FKBill FOREIGN KEY (Doctorid) REFERENCES Doctor(Doctorid) )
CREATE TABLE Pay_Bill( Paymentno INTEGER,
CREATE TABLE Patient( Patientno INTEGER, Name VARCHAR(40), Address VARCHAR(50), PhoneNo VARCHAR(20), Dob DATE, CONSTRAINT PKPatient PRIMARY KEY (Patientno) )
CREATE TABLE Payment( Paymentno INTEGER, Details VARCHAR(60), Method VARCHAR(20), Patientno INTEGER, CONSTRAINT PKPayment PRIMARY KEY (Paymentno), CONSTRAINT FKPayment FOREIGN KEY (Patientno) REFERENCES Patient(Patientno) )
CREATE TABLE Bill( Billno INTEGER, Total NUMERIC(10,2), Doctorid INTEGER, CONSTRAINT PKBill PRIMARY KEY (Billno), CONSTRAINT FKBill FOREIGN KEY (Doctorid) REFERENCES Doctor(Doctorid) )
CREATE TABLE Pay_Bill( Paymentno INTEGER, Billno INTEGER, CONSTRAINT PKPay_Bill PRIMARY KEY (Paymentno, Billno), CONSTRAINT FKPaymentno FOREIGN KEY (Paymentno) REFERENCES Payment(Paymentno), CONSTRAINT FKBillno FOREIGN KEY (Billno) REFERENCES Bill(Billno) )