--empolyee
select p.National_ID,Employee.Employee_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
p.Contact,p.Email,Salary, Hire_Date, Resign_Date from Employee
join (SELECT
p.National_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
c.Contact,e.Email
FROM person p
JOIN Contact c ON p.National_ID = c.National_ID
JOIN Email e ON p.National_ID = e.National_ID) as p on p.National_ID=Employee.National_ID
--Patient
select p.National_ID,Patient.Patient_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
p.Contact,p.Email,Residency_Start_Date, Residency_End_Date,Room_ID from Patient
join (SELECT
p.National_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
c.Contact,e.Email
FROM person p
JOIN Contact c ON p.National_ID = c.National_ID
JOIN Email e ON p.National_ID = e.National_ID) as p on p.National_ID=Patient.National_ID
-- doctor
select p.National_ID,p.Employee_ID ,p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
p.Contact,p.Email,d.Doctor_ID,Salary, Hire_Date, Resign_Date,
Department_Name, Year_Of_Experience,Qualification from
(select doctor.Doctor_ID,Employee_ID,Department_Name, Year_Of_Experience, Qualification from Doctor
join Doctor_Qualification on Doctor.Doctor_ID=Doctor_Qualification.Doctor_ID) as d
join (select p.National_ID,Employee.Employee_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
p.Contact,p.Email,Salary, Hire_Date, Resign_Date from Employee
join (SELECT
p.National_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
c.Contact,e.Email
FROM person p
JOIN Contact c ON p.National_ID = c.National_ID
JOIN Email e ON p.National_ID = e.National_ID) as p on p.National_ID=Employee.National_ID) as p
on p.Employee_ID=d.Employee_ID
--NonScientific_Employee
select p.National_ID,NSE_ROLE,NSE_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
p.Contact,p.Email,Salary, Hire_Date, Resign_Date,
Department_Name , p.Employee_ID from NonScientific_Employee as d
join (select p.National_ID,Employee.Employee_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
p.Contact,p.Email,Salary, Hire_Date, Resign_Date from Employee
join (SELECT
p.National_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
c.Contact,e.Email
FROM person p
JOIN Contact c ON p.National_ID = c.National_ID
JOIN Email e ON p.National_ID = e.National_ID) as p on p.National_ID=Employee.National_ID) as p
on p.Employee_ID=d.Employee_ID
--nurse
SELECT p.National_ID,p.Employee_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
p.Contact,p.Email,Salary, Hire_Date, Resign_Date,
n.Nurse_ID ,n.Room_ID,n.shift,n.Department_Name from (select Nurse.Nurse_ID ,Employee_ID,Room_ID,shift, Department_Name from Nurse
join Nurse_Department on Nurse_Department.Nurse_ID=Nurse.Nurse_ID
JOIN Nurse_AssignedRoom ON Nurse.Nurse_ID=Nurse_AssignedRoom.Nurse_ID) as n
join (select p.National_ID,Employee.Employee_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
p.Contact,p.Email,Salary, Hire_Date, Resign_Date from Employee
join (SELECT
p.National_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
c.Contact,e.Email
FROM person p
JOIN Contact c ON p.National_ID = c.National_ID
JOIN Email e ON p.National_ID = e.National_ID) as p on p.National_ID=Employee.National_ID) as p
on n.Employee_ID=p.Employee_ID
--Prescription
SELECT
Prescription.Patient_ID,Prescription.Prescription_ID,
Prescription_Date,Instructions,Diagnosis_Code,
Medicine.Medicine_ID, Medicine_Name, Expiry_Date,
Quantity, Dosage,Frequency
FROM Prescription_Medicine
JOIN Medicine ON Medicine.Medicine_ID = Prescription_Medicine.Medicine_ID
JOIN Prescription ON Prescription.Prescription_ID = Prescription_Medicine.Prescription_ID;
-- room
select
Room.Room_ID,
Device.Device_ID,
Room.Room_Type,
Room.Room_Capacity,
Room.Department_Name,
Device.Device_Name,
Device.Device_Type
FROM
Device
JOIN
Room
ON
Device.Device_ID = Room.Device_ID;
--Appointment
select Appointment.Appointment_ID,Appointment_Status, Room_ID, Appointment_Date, Patient_ID, Doctor_ID, amount, Tax, Discount
from Appointment
left join Bill on Bill.Appointment_ID=Appointment.Appointment_ID
Ci0tZW1wb2x5ZWUKc2VsZWN0IHAuTmF0aW9uYWxfSUQsRW1wbG95ZWUuRW1wbG95ZWVfSUQsIHAuRmlyc3ROYW1lLCBwLkxhc3ROYW1lLCBwLkJpcnRoRGF0ZSxwLkNpdHksIHAuc3RyZWV0LCBwLmdlbmRlcixwLnN0YXRlLCAKcC5Db250YWN0LHAuRW1haWwsU2FsYXJ5LCBIaXJlX0RhdGUsIFJlc2lnbl9EYXRlIGZyb20gRW1wbG95ZWUKam9pbiAoU0VMRUNUIApwLk5hdGlvbmFsX0lELCBwLkZpcnN0TmFtZSwgcC5MYXN0TmFtZSwgcC5CaXJ0aERhdGUscC5DaXR5LCBwLnN0cmVldCwgcC5nZW5kZXIscC5zdGF0ZSwgCmMuQ29udGFjdCxlLkVtYWlsCkZST00gcGVyc29uIHAKSk9JTiBDb250YWN0IGMgT04gcC5OYXRpb25hbF9JRCA9IGMuTmF0aW9uYWxfSUQKSk9JTiBFbWFpbCBlIE9OIHAuTmF0aW9uYWxfSUQgPSBlLk5hdGlvbmFsX0lEKSBhcyBwIG9uIHAuTmF0aW9uYWxfSUQ9RW1wbG95ZWUuTmF0aW9uYWxfSUQKLS1QYXRpZW50CnNlbGVjdCBwLk5hdGlvbmFsX0lELFBhdGllbnQuUGF0aWVudF9JRCwgcC5GaXJzdE5hbWUsIHAuTGFzdE5hbWUsIHAuQmlydGhEYXRlLHAuQ2l0eSwgcC5zdHJlZXQsIHAuZ2VuZGVyLHAuc3RhdGUsIApwLkNvbnRhY3QscC5FbWFpbCxSZXNpZGVuY3lfU3RhcnRfRGF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