CREATE TABLE DoctorSpecialty(
Doc_Specialty_Number INT not null IDENTITY PRIMARY KEY,
Doc_Specialty VARCHAR(30) not null,
);
INSERT INTO DoctorSpecialty( Doc_Specialty)
VALUES( 'Any specialty name.')
SELECT * FROM DoctorSpecialty;
CREATE TABLE Doctor (
Doctor_ID INT not null IDENTITY PRIMARY KEY,
Doctor_Name VARCHAR(20) not null,
Doctor_Phone VARCHAR(20) not null,
Doctor_Email VARCHAR(30),
Doc_Specialty_Number INT not null,
FOREIGN KEY (Doc_Specialty_Number) REFERENCES
DoctorSpecialty(Doc_Specialty_Number)
);
INSERT INTO Doctor( Doctor_Name, Doctor_Phone, Doctor_Email,
Doc_Specialty_Number)
VALUES( 'Some Doctor', '4164172233', '
[email protected]', 1)
SELECT * FROM Doctor;
CREATE TABLE Patient (
Patient_ID INT not null IDENTITY PRIMARY KEY,
Patient_Name VARCHAR(20) not null,
Patient_Phone VARCHAR(20) not null,
Patient_Email VARCHAR(30),
Patient_Address VARCHAR(50) not null,
Patient_RegisterDate DATE not null,
Doctor_ID INT not null,
FOREIGN KEY (Doctor_ID) REFERENCES Doctor(Doctor_ID)
);
INSERT INTO Patient ( Patient_Name, Patient_Phone, Patient_Email, Patient_Address,
Patient_RegisterDate, Doctor_ID)
VALUES( 'Some Patient', '4164442277', '
[email protected]', '111 Some Street',
'2022-05-05', 1)
SELECT * FROM Patient;
CREATE TABLE Allergy (
Patient_Allerg_ID INT not null IDENTITY PRIMARY KEY,
Allergy_Name VARCHAR(20) not null,
);
INSERT INTO Allergy( Allergy_Name)
VALUES( 'Any allergy name.')
SELECT * FROM Allergy;
CREATE TABLE PatAllergies (
Patient_Allerg_ID INT not null IDENTITY PRIMARY KEY,
Patient_ID INT not null,
FOREIGN KEY (Patient_Allerg_ID) REFERENCES Allergy(Patient_Allerg_ID),
FOREIGN KEY (Patient_ID) REFERENCES Patient(Patient_ID)
);
CREATE TABLE Appointment (
Appoint_ID INT not null IDENTITY PRIMARY KEY,
Appoint_Date DATE not null,
Patient_ID INT not null,
Doctor_Name VARCHAR(20) not null,
Patient_Bloodplssr INT not null,
Doctors_Treatnote VARCHAR(100),
FOREIGN KEY (Patient_ID) REFERENCES Patient(Patient_ID),
);
INSERT INTO Appointment( Appoint_Date, Patient_ID, Doctor_Name, Patient_Bloodplssr,
Doctors_Treatnote)
VALUES( '2022-11-15', 1, 'Some Doctor', 110, 'Any note.')
SELECT * FROM Appointment;
CREATE TABLE Medicine (
Medicine_ID INT not null IDENTITY PRIMARY KEY,
Medicine_Name VARCHAR(50) not null,
);
INSERT INTO Medicine( Medicine_Name)
VALUES( 'Any medicine name.')
SELECT * FROM Medicine;
CREATE TABLE AppointMedicines (
Medicine_ID INT not null,
Appoint_ID INT not null IDENTITY PRIMARY KEY,
FOREIGN KEY (Medicine_ID) REFERENCES Medicine(Medicine_ID)
);
INSERT INTO Medicine( Medicine_ID)
VALUES( 001)
SELECT * FROM AppointMedicine;