Advertisement
Guest User

Untitled

a guest
May 6th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.75 KB | None | 0 0
  1. BABA ICINI DOLDURDUGUMUZ VERILER VAR YA ONLARDA 3 ADET HATA CIKTI BI BAKAR MISIN BEN BURDA BULAMADIM ONDAN SONRA SADECE SELECT KALICAK SEN BAKARKEN BENDE JAVA ILE PROJEYI YAPMAYA CALISICAMDA
  2.  
  3. -- Table: Ambulance
  4. CREATE TABLE Ambulance (
  5. Ambulance_Id integer NOT NULL,
  6. Plaque_No integer NOT NULL,
  7. CONSTRAINT Ambulance_pk PRIMARY KEY (Ambulance_Id)
  8. ) ;
  9.  
  10. -- Table: Appointment
  11. CREATE TABLE Appointment (
  12. Appointment_id integer NOT NULL,
  13. Department_name varchar2(50) NOT NULL,
  14. Doctor_Identify integer NOT NULL,
  15. Doctor_Gender varchar2(15) NOT NULL,
  16. Patient_number integer NOT NULL,
  17. Date_of_birth date NOT NULL,
  18. date_of_appointment date NOT NULL,
  19. Patient_complaint varchar(10) NOT NULL,
  20. CONSTRAINT Appointment_pk PRIMARY KEY (Appointment_id)
  21. ) ;
  22.  
  23. -- Table: Hospital
  24. CREATE TABLE Hospital (
  25. Hospital_Id integer NOT NULL,
  26. eName varchar2(150) NOT NULL,
  27. Address varchar2(200) NOT NULL,
  28. Phone integer NOT NULL,
  29. Fax integer NOT NULL,
  30. Email varchar2(100) NOT NULL,
  31. Standart_room_number integer NOT NULL,
  32. Private_room_number integer NOT NULL,
  33. Ambulance_Ambulance_Id integer NULL,
  34. Room_info_id integer NULL,
  35. Personel_Info_Personal_Id integer NULL,
  36. Patient_info_id integer NULL,
  37. Appointment_Appointment_id integer NULL,
  38. CONSTRAINT Hospital_pk PRIMARY KEY (Hospital_Id)
  39. ) ;
  40.  
  41. -- Table: Information_about_patient
  42. CREATE TABLE Information_about_patient (
  43. Patient_Id integer NOT NULL,
  44. Name_Surname varchar2(100) NOT NULL,
  45. Gender varchar2(15) NOT NULL,
  46. Hospital_Hospital_Id integer NULL,
  47. Ambulance_Ambulance_Id integer NULL,
  48. movement_information_Id integer NULL,
  49. Room_information_Id integer NULL,
  50. CONSTRAINT Information_about_patient_pk PRIMARY KEY (Patient_Id)
  51. ) ;
  52.  
  53. -- Table: Patient_movement_information
  54. CREATE TABLE Patient_movement_information (
  55. Patient_move_info_Id integer NOT NULL,
  56. Made_operation varchar2(100) NOT NULL,
  57. Price integer NOT NULL,
  58. CONSTRAINT Patient_movement_informatio_pk PRIMARY KEY (Patient_move_info_Id)
  59. ) ;
  60.  
  61. -- Table: Personel_Information
  62. CREATE TABLE Personel_Information (
  63. Personal_Id integer NOT NULL,
  64. Idenity_sumber integer NOT NULL,
  65. Name_surname varchar2(150) NOT NULL,
  66. Profession varchar2(150) NOT NULL,
  67. Start_date_to_job date NOT NULL,
  68. info_Patient_Id integer NULL,
  69. CONSTRAINT Personel_Information_pk PRIMARY KEY (Personal_Id)
  70. ) ;
  71.  
  72. -- Table: Room_Information
  73. CREATE TABLE Room_Information (
  74. Room_information_Id integer NOT NULL,
  75. Bed_number integer NOT NULL,
  76. Private_room varchar2(10) NOT NULL,
  77. Standart_room varchar2(10) NOT NULL,
  78. Hospital_name varchar2(150) NOT NULL,
  79. CONSTRAINT Room_Information_pk PRIMARY KEY (Room_information_Id)
  80. ) ;
  81.  
  82. -- foreign keys
  83. -- Reference: Hospital_Ambulance (table: Hospital)
  84. ALTER TABLE Hospital ADD CONSTRAINT Hospital_Ambulance
  85. FOREIGN KEY (Ambulance_Ambulance_Id)
  86. REFERENCES Ambulance (Ambulance_Id);
  87.  
  88. -- Reference: Hospital_Appointment (table: Hospital)
  89. ALTER TABLE Hospital ADD CONSTRAINT Hospital_Appointment
  90. FOREIGN KEY (Appointment_Appointment_id)
  91. REFERENCES Appointment (Appointment_id);
  92.  
  93. -- Reference: Hospital_Patient (table: Hospital)
  94. ALTER TABLE Hospital ADD CONSTRAINT Hospital_Patient
  95. FOREIGN KEY (Patient_info_id)
  96. REFERENCES Patient_movement_information (Patient_move_info_Id);
  97.  
  98. -- Reference: Hospital_Personel (table: Hospital)
  99. ALTER TABLE Hospital ADD CONSTRAINT Hospital_Personel
  100. FOREIGN KEY (Personel_Info_Personal_Id)
  101. REFERENCES Personel_Information (Personal_Id);
  102.  
  103. -- Reference: Hospital_Room (table: Hospital)
  104. ALTER TABLE Hospital ADD CONSTRAINT Hospital_Room
  105. FOREIGN KEY (Room_info_id)
  106. REFERENCES Room_Information (Room_information_Id);
  107.  
  108. -- Reference: Info_patient_Ambulance (table: Information_about_patient)
  109. ALTER TABLE Information_about_patient ADD CONSTRAINT Info_patient_Ambulance
  110. FOREIGN KEY (Ambulance_Ambulance_Id)
  111. REFERENCES Ambulance (Ambulance_Id);
  112.  
  113. -- Reference: Info_patient_Hospital (table: Information_about_patient)
  114. ALTER TABLE Information_about_patient ADD CONSTRAINT Info_patient_Hospital
  115. FOREIGN KEY (Hospital_Hospital_Id)
  116. REFERENCES Hospital (Hospital_Id);
  117.  
  118. -- Reference: Personel_Information (table: Personel_Information)
  119. ALTER TABLE Personel_Information ADD CONSTRAINT Personel_Information
  120. FOREIGN KEY (info_Patient_Id)
  121. REFERENCES Information_about_patient (Patient_Id);
  122.  
  123. -- Reference: patient_Room_info (table: Information_about_patient)
  124. ALTER TABLE Information_about_patient ADD CONSTRAINT patient_Room_info
  125. FOREIGN KEY (Room_information_Id)
  126. REFERENCES Room_Information (Room_information_Id);
  127.  
  128. -- Reference: patient_move_info (table: Information_about_patient)
  129. ALTER TABLE Information_about_patient ADD CONSTRAINT patient_move_info
  130. FOREIGN KEY (movement_information_Id)
  131. REFERENCES Patient_movement_information (Patient_move_info_Id);
  132.  
  133. UPDATE Hospital
  134. Set
  135. insert into Ambulance (Ambulance_Id, Plaque_No,) values
  136. (1, '06AB127'),
  137. (2, '34DS111'),
  138. (3, '35ABCD123');
  139.  
  140. insert into Appointment (Appointment_id, Department_name, Doctor_Identify, Doctor_Gender, Patient_number,Date_of_birth, date_of_appointment,Patient_complaint) values
  141. (1, 'otorhinolaryngology', '123456', 'M', '123123', '30/12/06', '30/12/06','Ear'),
  142. (2, 'dietitian', '123426', 'M', '112123', '30/12/06', '30/12/06','Over-weight'),
  143. (3, 'otorhinolaryngology', '1231456', 'M', '1223123', '30/12/06', '30/12/06','Nose');
  144.  
  145. insert into Hospital (Hospital_Id, eName, Address, Phone, Fax, Email, Standart_room_number, Private_room_number) values
  146.  
  147. (1, 'Gazi Hospital', 'xxxAddressxxx', '123123123', '123123', 'sdadada@gmail.com', '60','40'),
  148. (2, 'Hacettepe Hospital', 'xxxAddressxx', '123123123', '112123', 'sdadada@gmail.com', '70','50'),
  149. (3, 'Ankara university hospital', 'xxxAddressxx', '123123123', '1223123', 'sdadada@gmail.com', '50','30');
  150.  
  151. insert into Information_about_patient (Patient_Id, Name_Surname, Gender) values
  152. (1, 'Clark', 'Man'),
  153. (2, 'Emir', 'Man'),
  154. (3, 'Tony''Man')
  155.  
  156. insert into Patient_movement_information(Patient_move_info_Id, Made_operation, Price) values
  157. (1, 'Test', '500'),
  158. (2, 'Surgery', '1000'),
  159. (3, 'Take blood', '300')
  160. insert into Personel_Information(Personal_Id, Idenity_sumber, Name_surname, Profession, Start_date_to_job,) values
  161. (1, '123456', 'Clark xx ', 'Ear', '10/05/2018'),
  162. (2, '234562', 'Michal xx', 'Surgeon','10/05/2018'),
  163. (3, '345612', 'Emma xx', 'Throat','10/05/2018')
  164.  
  165. insert into Room_Information(Room_information_Id, Bed_number, Private_room, Standart_room, Hospital_name) values
  166. (1, '2', 'No', 'Yes', 'Gazi Hospital'),
  167. (2, '1', 'Yes', 'No', 'Hacettepe Hospital'),
  168. (3, '2', 'No', 'Yes', 'Ankara university hospital')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement