Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

INSERT INTO person (first_name , last_name , dob , address , phone , gender)

VALUES ('Chall' , 'Nimas' , '20-APR-97' , '300, Taman Golf, Jalan Lumba Kuda 05660,
Alor Setar, Kedah' , '012-8803554','M'),
VALUES ('Lui' , 'Vintong' , '12-MAY-95' , 'No. 157 A Jln Aminuddin Baki, Taman Tun
Dr Ismail,60000, Kuala Lumpur, Wilayah Persekutuan' , '013-7890067' , 'F'),
VALUES ('Kao' , 'Lui' , '02-SEP-00' , '55 Jln Pengkalan Barat, Taman Kar King
31650, Ipoh , Perak' , '017-4572798' , 'F'),
VALUES ('Wong' , 'Xiao' , '01-NOV-94' , '1448, Jalan Cenderasari, Taman Tasik
Perdana 50480, Kuala Lumpur, Wilayah Persekutuan' , '011-3454542' , 'F') ,
VALUES ('How' , 'Wee' , '03-Mar-07' , '17,Jln Pju 8/3B Bandar Damasara Perdana
47820, Petaling Jaya, Selangor' , ' 012-9803345' , 'M'),
VALUES('Sabri' , 'Fakri' , '28-Feb-80' , 'Lot 5068/ 9 5 1/4
Miles Jalan Meru 41050, Klang, Selangor' , '017-5567215' , 'M'),
VALUES('Qi' , 'Heng' , '05-May-13' , '12, Jalan Tapah 1
Stulang Baru 81100, Johor Bahru, Johor' , '019-9004454' , 'M'),
VALUES('Alia' , 'Chin' , '31-Aug-93' , 'No. 4 Ground
Floor Jln Yam Tuan 70000, Seremban, Negeri Sembilan' , '013-6945689' ,
'M'),
VALUES('Tan' , 'Long' , '07-Nov-10' , '123 - G Jalan SS 15 /
5A 47510, Subang Jaya, Selangor' , '012 - 3870592' , 'M'),
VALUES('Sudden' , 'Lee' , '25-Jan-79' , '35, Jln Mutiara Emas
6 / 3 Taman Mount Austin 81100, Johor Bahru, Johor' , '015-4747990' ,
'M');

Insert into Specialist (person_id,specialization_id)


VALUES(2 , 'surgery'),
VALUES(4 , 'neurology'),
VALUES(6 , 'gynecology'),
VALUES(8 , 'gastroenterology'),
VALUES(10 , 'orthopedics'),

Insert into Patient(person_id,blood_type)


VALUES(1 , 'A-'),
VALUES(3 , 'B'),
VALUES(5 , 'B'),
VALUES(7 , 'O+'),
VALUES(9 , 'AB');

Insert into Ward(ward_id,ward_number,level)


VALUES(seq_ward.nextval , 2 , 2);
VALUES(seq_ward.nextval , 2 , 2);
VALUES(seq_ward.nextval , 2 , 2);
VALUES(seq_ward.nextval , 3 , 2);
VALUES(seq_ward.nextval , 3 , 2);

Insert into Bed(bed_id, ward_id, level, bed_number)


VALUES(3 , 1 , 2 , 1);
VALUES(2 , 5 , 2 , 3);
VALUES(5 , 2 , 2 , 3);
VALUES(1 , 4 , 2 , 2);
VALUES(4 , 3 , 2 , 5);

Insert into Admission (admission_id, bed_id, consultation_id, admission_time,


discharge_time)
VALUES(1 , 3 , 1 , '11-APR- 23 10.55.00 AM' , 'NULL' );
VALUES(2 , 2 , 2 , '12-APR- 23 12.58.00 PM' , '13-APR- 23 03.02.00
PM' );
VALUES(3 , 5 , 3 , '12-APR- 23 04.25.00 PM' , '15-APR- 23 12.47.00
PM' );
VALUES(4 , 1 , 4 , '14-APR- 23 06.19.00 PM' , 'NULL' );
VALUES(5 , 4 , 5 , '16-APR- 23 08.25.00 PM' , '18-APR- 23 06.39.00
PM' );

Insert Into Consultation ( consultation_id, p_id, s_id, consultation_time)


VALUES(seq_consult.nextval , seq_Person.nextval , seq_Specialist.nextval ,
'11-APR-23 10.35.00 AM');
VALUES(seq_consult.nextval , seq_Person.nextval , seq_Specialist.nextval ,
'12-APR-23 12.47.00 PM');
VALUES(seq_consult.nextval , seq_Person.nextval , seq_Specialist.nextval ,
'12-APR-23 04.16.00 PM');
VALUES(seq_consult.nextval , seq_Person.nextval , seq_Specialist.nextval ,
'14-APR-23 06.11.00 PM');
VALUES(seq_consult.nextval , seq_Person.nextval , seq_Specialist.nextval ,
'16-APR-23 08.22.00 PM');

Create VIEW consultation_view AS


SELECT p.first_name||' '||p.last_name "Patient Name", s.first_name||' '||
s.last_name "Specialist Name", consultation_time
FROM consultation c
Join Person p
ON c.p_id = p.person_id
Join Person S
ON c.s_id = s.person_id;

Create VIEW admission_view AS


SELECT p.first_name||' '||p.last_name "Patient Name" , s.first_name||' '||
s.last_name "Specialist Name" , level , ward_number ,
bed_number ,a.admission_time, a.discharged_time
From admission A
Join Consultation C
On A.consultation_id = C.consultation_id
Join Person S
On C.s_id = S.person_id
Join Person P
On C.s_id = P.person_id
Join Bed B
On A.bed_id = B.bed_id
Join Ward W
On B.ward_id = W.ward_id;

Create VIEW patient_privacy_view AS


SELECT p.person_id, p.first_name||' '||p.last_name "Patient Name" , phone ,
gender , blood_type
From Person p
Join Patient pa
On p.person_id = pa.person_id
;

Create VIEW upcoming_appointment_view AS


SELECT person_id , p.first_name||' '||p.last_name "Patient Name"
s.first_name||' '||s.last_name "Specialist Name" , appointment_time
FROM appointment a
Join person p
ON a.p_id = p.person_id
Join person s
ON a.s_id = s.person_id
;

Create VIEW specialist_view AS


SELECT p.person_id , p.first_name||' '||p.last_name "Specialist Name" ,
p.phone , s.specialization_name
FROM person p
Join specialist s
On p.person_id = s.person_id
Join specialization sp
On s.specialization_id = sp.specialization_id
;

You might also like