0% found this document useful (0 votes)
28 views4 pages

Dms Queries

queries for creating various tables for reference

Uploaded by

jgaikwad737
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views4 pages

Dms Queries

queries for creating various tables for reference

Uploaded by

jgaikwad737
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

CREATE TABLE Patient (patient_id number (4)PRIMARY KEY,name VARCHAR(255) NOT NULL,dob DATE

NOT NULL,address varchar(25),phone number (20));

CREATE TABLE Doctor (doctor_id number (5)PRIMARY KEY,name VARCHAR(25) NOT


NULL,specialization VARCHAR(255) NOT NULL,schedule varchar(10));

CREATE TABLE Billing (billing_id number(8) PRIMARY KEY,patient_id number(4) NOT NULL,amount
number(9) NOT NULL,billing_date DATE NOT NULL,FOREIGN KEY (patient_id) REFERENCES
Patient(patient_id));

CREATE TABLE Appointment (a_id number(5)PRIMARY KEY,patient_id number(4) NOT NULL,doctor_id


number(5) NOT NULL,a_date DATE NOT NULL,FOREIGN KEY (patient_id) REFERENCES
Patient(patient_id),FOREIGN KEY (doctor_id) REFERENCES Doctor(doctor_id));

desc patient;

desc doctor;

desc Billing;

desc Appointment;

desc test_report;

insert into patient values(67,'shweta','27-jan-2005','dhule',9040382931);

insert into patient values(834,'sakshi','2-dec-2021','mumbai',2445689768);

insert into patient values(124,'priya','28-feb-2010','thane',6584833922);

insert into patient values(92,'anjali','07-mar-2007','dehradun',9787556434);

insert into patient values(11,'sakhi','20-oct-2007','delhi',9048323552);

select * from patient;

insert into doctor values(83,'pranjal','mch plastic surgery','morn-noon');

insert into doctor values(163,'priyanka','urologist','noon-even');

insert into doctor values(1,'harshali','cardiologist','noon-even');

insert into doctor values(197,'ishani','gynecologist','24hours');

insert into doctor values(53,'anvi','radiologist','noon-even');

select * from doctor;


insert into billing values(028292,67,700800,'22-jan-2023');

insert into billing values(934638,834,340002,'31-jan-2023');

insert into billing values(9126,124,50000,'26-feb-2023');

insert into billing values(2358498,92,480000,'21-feb-2023');

insert into billing values(835464,11,20000,'1-mar-2023');

select * from billing;

insert into test_report values('dengue',67,'negative',029);

insert into test_report values('chickengunia',834,'positive',712);

insert into test_report values('lukemia',124,'positive',949);

insert into test_report values('plain cbc',92,'negative',071);

insert into test_report values('cbc',11,'positive',31);

select * from test_report;


insert into appointment values(978,67,83,'6-mar-2024');

insert into appointment values(321,834,163,'3-jan-2024');

insert into appointment values(86,124,197,'1-mar-2024');

insert into appointment values(089,92,1,'20-oct-2024');

insert into appointment values(078,11,53,'28-jun-2024');

desc appointment;

select * from appointment;

select * from patient full outer join billing on patient.patient_id=billing.patient_id;

select * from patient full outer join appointment on patient.patient_id=appointment.patient_id;

select * from patient full outer join test_report on patient.patient_id=test_report.patient_id;

select * from appointment full outer join doctor on doctor.doctor_id=appointment.doctor_id;

You might also like