Professional Documents
Culture Documents
Final Project
Doc Na Age
day me
_id
Doc_tim
e
Pat_id
Appoint
system Patient
Booking_i
Doc_id
d s
Name
Preferred
Doc_locat
Doc_speci time
ion
alization
Pat_id
Bill date
Time slot
Bill
Bill Range
Bill
status
number id
Project name: Doctor’s Appointment System
ID:C191208
Page no:03
Table: SQL
1.Doctor:
CREATE TABLE
“DOCTOR”(DOC_ID”VARCHAR2(40),”NAME”VRCHAR2(20),”DAYS”VARCHAR2(100)
,”DOC_TIME”VARCHAR2(24),”DOC_LOCATION”VARCHAR(40),”DOC_SPECIALITY”V
ARCHAR2(50),CONSTANT”DOCTOR_PK”PRIMARY KEY (“DOC_ID”)ENABLE)/
2.Patient:
CREATE TABLE “PATIENT”
( “PAT_ID “VARCAHR2(10),
“NAME”VARCHAR2(50),
“AGE”VRCHAR2(100),
“SEX”VARCHAR2(5),
“PAT_LOCTION”VARCHAR(40),
CONSTANT “PATIENT_PK”PRIMARY KEY (PAT_ID”)ENABLE,
)
Project name: Doctor’s Appointment System
ID:C191208
Page no:04
3.Appointment_Details:
“PAT_ID”VARCHAR2(100),
“DOC_ID”VARCHAR2(15),
“PREFFERED_TIME”VARCHAR2(400),
CONSTRANT “APPOINTMENT_DETAILS_OK”PRIMARY KEY (“BOOKING_ID”)
ENABLE,
4.Time Slots:
5.BILL:
CREATE TABLE “BILL”
( “BILL_NUMBER”VARCHAR2(40)’
“BILL_DATE”VARCHAR2(31),
“BILL_STATUS”VARCHAR2(40),
CONSTRANT”BILL_PK”PRIMARY KEY(“BILL_NUMBER”)ENABLE
)
/
Project name: Doctor’s Appointment System
ID:C191208
Page no:06
DML STATEMENT:
QUERY: Search data from individual table
1.
select *
from DOCTOR;
2.
Select*
From PATIENT;
Project name: Doctor’s Appointment System
ID:C191208
Page no:12
3.
select *
from PATIENT
where pat_id='p1';
4.
select*
from PATIENT
where pat_id='p9';
Project name: Doctor’s Appointment System
ID:C191208
Page no:13
5.
select doc_id,name,doc_location
from DOCTOR;
6.
select *
from DOCTOR
where doc_location='chittagong';
Project name: Doctor’s Appointment System
ID:C191208
Page no:14
7.
select*
from BILL
where bill_date='6-MAY-21';
8.
select *
from PATIENT
where name LIKE'S%';
Project name: Doctor’s Appointment System
ID:C191208
Page no:15
9.
select health_issue,preferred_time
from APPOINTMENT_DETAILS;
10.
select *
from APPOINTMENT_DETAILS
where preferred_time='23-MAY-21';
Project name: Doctor’s Appointment System
ID:C191208
Page no:16
11.
select max(range),min(range)
from TIME_SLOTS;
2.
select pat_id,name,preferred_time
from PATIENT natural join APPOINTMENT_DETAILS
where preferred_time='01-JAN-21';
3.
select P.pat_id,P.name,A.booking__id
from PATIENT P,APPOINTMENT_DETAILS A
where P.pat_id=A.pat_id and booking__id='b111';
4.
select doc_id,preferred_time
from DOCTOR natural join APPOINTMENT_DETAILS
where name='Maria';
Project name: Doctor’s Appointment System
ID:C191208
Page no:18
5.
select doc_id,pat_id,doc_location,doc_specilization
from DOCTOR natural join APPOINTMENT_DETAILS;
Sub-Query:
1.
select *
from DOCTOR
where name Like(select name
from DOCTOR
where name ='Tina');
Project name: Doctor’s Appointment System
ID:C191208
Page no:19
2.
select pat_id,name,age
from PATIENT
where age>(select AVG (age)
from PATIENT);
3.
select pat_id,name,sex
from PATIENT
where pat_id=(select pat_id
from APPOINTMENT_DETAILS
where doc_id='d1');
Project name: Doctor’s Appointment System
ID:C191208
Page no:20
4.
select pat_id,name,age
from PATIENT
where age=(select min(age)
from PATIENT);
PL/SQL:
DECLARE
docid DOCTOR.doc_id%type;
dname DOCTOR.d_name%type;
days DOCTOR.days%type;
BEGIN
dbms_output.put_line('days:'||days);
END;
Project name: Doctor’s Appointment System
ID:C191208
Page no:21
Docid:d123
Days:Tuesday
Statement processed.
0.00 second