Professional Documents
Culture Documents
Database Management System Cycle 1 Hospital Database
Database Management System Cycle 1 Hospital Database
Database Management System Cycle 1 Hospital Database
Program: B.Tech
Course: CSE2004 – DBMS Database Management Systems Lab
CSE2004
1. Create all tables in Hospital database as per the requirement given below;
a) The primary key for each table to be created as specified (refer database)
b) Appropriate data type and size should be chosen for each attribute
c) Appropriate integrity constraints should be used while creating tables (NULL, NOT NULL,
FOREIGN KEY, CHECK)
d) The values for some attributes should be as follows; include appropriate CHECK constraints
to achieve them.
i) Primary key values should be created with uniformity. For example, Doc_ID can be like
‘D0001’ [five characters long and start with ‘D’], Staff_ID like ‘S0001’, Pres_ID like ‘PR00001’
and so on.
ii) Attributes and permitted values (you can decide and include such values wherever
required)
Gender char,
DOB date,
Specialist varchar(20),
Qualification varchar(5),
Contact number(7),
Address varchar(10),
Dept_No varchar(4));
Dept_Name varchar(25),
Floor number,
HOD varchar(5),
Estd_Date date,
Staff_Name varchar(10),
Category varchar(15),
Designation varchar(25) ,
DOB date,
Contact number(10),
Address varchar(10),
Dept_No varchar(4),
Pat_Name varchar(20),
DOB date,
Gender char,
Contact number(10),
Address varchar(20));
Create table In_Patient (
Date_Of_Admission date ,
Bed_No number,
Start_Time timestamp,
End_Time timestamp,
Pat_ID varchar(7),
Pres_ID varchar(7),
Pat_ID varchar(7),
Doc_ID varchar(5),
Nurse_ID varchar(5),
Consult_Room_No number,
Datep date,
Time timestamp,
App_ID varchar(7),
Datep date,
Time timestamp,
Diagnosis_Detail varchar(20),
Pres_ID varchar(7),
Dosage varchar(6),
Brand varchar(20),
Inv_Date date,
Pat_ID varchar(7),
Bill_Amount number(6),
Payment_Type varchar(12),
discount number,
Pat_ID varchar(7),
Datel Date,
Time timestamp,
Resultt varchar(7),
Description varchar(25),
Low_Value int,
High_Value int,
Test_Method varchar(10),
Technician varchar(5),
'Diabetes','MS',0123123,'Vellore','D001');
,'Diabetes','MBBS',0123651,'Vellore','D015');
'01-Mar-1971','Cardiology','MS',0123324,'Vellore','D102');
INSERT INTO Doctor VALUES('D0004','Dr.Seeta','F','23-May-1971'
,'General_medicine','BDS',0123789,'Vellore','D013');
,'31-Dec-1975','Ophthalmology','MDS',0123980,'Vellore','D014');
,'Neurology','MS',0123560,'Vellore','D016');
,'Diabetes','MBBS',0123780,'Vellore','D190');
0918765432,'Vellore','D015');
INSERT INTO Staff values('S0002','Neha','lab technician','Senior technician','11-Jun-1981',
0918765433,'Vellore','D001');
0918765434,'Vellore','D102');
0918765435,'Vellore','D013');
0918765436,'Vellore','D014');
0918765437,'Vellore','D016');
0918765438,'Vellore','D001');
0918765439,'Vellore','D001');
0918765430,'Vellore','D190');
0918765431,'Vellore','D102');
'01-Jan-2020,06:12:12','01-Jan-2020,11:12:12 PM');
'11-Jan-2020,07:00:00','13-Jan-2020,11:00:00 PM');
'21-Jan-2020,06:00:00','05-Feb-2020,11:18:15 PM');
'10-Feb-2020,06:12:12','11-Feb-2020,11:12:12 PM');
'12-Feb-2020,07:12:12','12-Feb-2020,10:11:12 PM');
'26-Feb-2020,06:12:12','26-Feb-2020,10:12:12 PM');
'01-May-2020,05:10:12','04-May-2020,10:12:12 PM');
'11-May-2020,06:00:00','12-May-2020,10:10:22 PM');
'21-May-2020,06:12:12','21-May-2020,10:12:12 PM');
'01-Jun-2020,06:12:12','01-Jun-2020,11:12:12 PM');
'S0001',321,'1-Jan-2020','01-Jan-2020,06:30:00');
'S0002',324,'11-Jan-2020','11-Jan-2020,07:30:00');
'S0003',221,'21-Jan-2020','21-Jan-2020,06:30:00');
'S0004',121,'1-Jan-2020','10-Feb-2020,06:30:00');
'S0005',351,'1-Jan-2020','12-Feb-2020,07:30:00');
'S0006',329,'1-Jan-2020','26-Feb-2020,06:30:00');
'S0007',421,'1-Jan-2020','01-May-2020,05:30:00');
insert into Appointment values('AP00008','PA00008','D0001',
'S0008',300,'1-Jan-2020','11-May-2020,06:30:00');
'S0009',382,'1-Jan-2020','21-May-2020,06:30:00');
'S0010',112,'1-Jan-2020','01-Jun-2020,06:30:00');
'PA00001',100000,'debit card','20%');
'PA00002',160000,'debit card','10%');
'PA00001',80000,'cash','2%');
'PA00001','108000','debit card','5%');
'PA00001','150000','debit card','10%');
'PA00001','20000','credit card','5%');
'PA00001','200000','debit card','10%');
'PA00001','5000','cash','10%');
insert into Hospital_Bill values('00009','01-Jan-2020',
'PA00001','190000','credit card','10%');
'PA00001','100800','credit card','20%');