fork download
  1.  
  2. --empolyee
  3. select p.National_ID,Employee.Employee_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
  4. p.Contact,p.Email,Salary, Hire_Date, Resign_Date from Employee
  5. join (SELECT
  6. p.National_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
  7. c.Contact,e.Email
  8. FROM person p
  9. JOIN Contact c ON p.National_ID = c.National_ID
  10. JOIN Email e ON p.National_ID = e.National_ID) as p on p.National_ID=Employee.National_ID
  11. --Patient
  12. select p.National_ID,Patient.Patient_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
  13. p.Contact,p.Email,Residency_Start_Date, Residency_End_Date,Room_ID from Patient
  14. join (SELECT
  15. p.National_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
  16. c.Contact,e.Email
  17. FROM person p
  18. JOIN Contact c ON p.National_ID = c.National_ID
  19. JOIN Email e ON p.National_ID = e.National_ID) as p on p.National_ID=Patient.National_ID
  20. -- doctor
  21. select p.National_ID,p.Employee_ID ,p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
  22. p.Contact,p.Email,d.Doctor_ID,Salary, Hire_Date, Resign_Date,
  23. Department_Name, Year_Of_Experience,Qualification from
  24. (select doctor.Doctor_ID,Employee_ID,Department_Name, Year_Of_Experience, Qualification from Doctor
  25. join Doctor_Qualification on Doctor.Doctor_ID=Doctor_Qualification.Doctor_ID) as d
  26. join (select p.National_ID,Employee.Employee_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
  27. p.Contact,p.Email,Salary, Hire_Date, Resign_Date from Employee
  28. join (SELECT
  29. p.National_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
  30. c.Contact,e.Email
  31. FROM person p
  32. JOIN Contact c ON p.National_ID = c.National_ID
  33. JOIN Email e ON p.National_ID = e.National_ID) as p on p.National_ID=Employee.National_ID) as p
  34. on p.Employee_ID=d.Employee_ID
  35. --NonScientific_Employee
  36. select p.National_ID,NSE_ROLE,NSE_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
  37. p.Contact,p.Email,Salary, Hire_Date, Resign_Date,
  38. Department_Name , p.Employee_ID from NonScientific_Employee as d
  39. join (select p.National_ID,Employee.Employee_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
  40. p.Contact,p.Email,Salary, Hire_Date, Resign_Date from Employee
  41. join (SELECT
  42. p.National_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
  43. c.Contact,e.Email
  44. FROM person p
  45. JOIN Contact c ON p.National_ID = c.National_ID
  46. JOIN Email e ON p.National_ID = e.National_ID) as p on p.National_ID=Employee.National_ID) as p
  47. on p.Employee_ID=d.Employee_ID
  48. --nurse
  49. SELECT p.National_ID,p.Employee_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
  50. p.Contact,p.Email,Salary, Hire_Date, Resign_Date,
  51. 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
  52. join Nurse_Department on Nurse_Department.Nurse_ID=Nurse.Nurse_ID
  53. JOIN Nurse_AssignedRoom ON Nurse.Nurse_ID=Nurse_AssignedRoom.Nurse_ID) as n
  54. join (select p.National_ID,Employee.Employee_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
  55. p.Contact,p.Email,Salary, Hire_Date, Resign_Date from Employee
  56. join (SELECT
  57. p.National_ID, p.FirstName, p.LastName, p.BirthDate,p.City, p.street, p.gender,p.state,
  58. c.Contact,e.Email
  59. FROM person p
  60. JOIN Contact c ON p.National_ID = c.National_ID
  61. JOIN Email e ON p.National_ID = e.National_ID) as p on p.National_ID=Employee.National_ID) as p
  62. on n.Employee_ID=p.Employee_ID
  63. --Prescription
  64. SELECT
  65. Prescription.Patient_ID,Prescription.Prescription_ID,
  66. Prescription_Date,Instructions,Diagnosis_Code,
  67. Medicine.Medicine_ID, Medicine_Name, Expiry_Date,
  68. Quantity, Dosage,Frequency
  69. FROM Prescription_Medicine
  70. JOIN Medicine ON Medicine.Medicine_ID = Prescription_Medicine.Medicine_ID
  71. JOIN Prescription ON Prescription.Prescription_ID = Prescription_Medicine.Prescription_ID;
  72. -- room
  73. select
  74. Room.Room_ID,
  75. Device.Device_ID,
  76. Room.Room_Type,
  77. Room.Room_Capacity,
  78. Room.Department_Name,
  79. Device.Device_Name,
  80. Device.Device_Type
  81.  
  82. FROM
  83. Device
  84. JOIN
  85. Room
  86. ON
  87. Device.Device_ID = Room.Device_ID;
  88. --Appointment
  89. select Appointment.Appointment_ID,Appointment_Status, Room_ID, Appointment_Date, Patient_ID, Doctor_ID, amount, Tax, Discount
  90. from Appointment
  91. left join Bill on Bill.Appointment_ID=Appointment.Appointment_ID
Success #stdin #stdout #stderr 0.01s 5276KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Error: near line 3: near "select": syntax error
Error: near line 73: no such table: Device
Error: near line 89: no such table: Appointment