HOSPITAL MANAGEMENT SYSTEM
Sasui Hidatyatullah lohar 2k12/BsIt/73
University of Sindh jamshoro
 As we know that the manual system is too much difficult
to handle the record in our daily life. In the present era
of globalization and advanced technology efficient
record keeping cannot be overemphasized. Imagine the
scenario when the manual processes and manual
modes of instruction get replaced with electronic
systems. One of such replacement can be done in the
area of patient’s database management system within a
hospital. Developing patient database management
system software would benefit the hospital management
who can have effortless access to the data securely and
more easilsy.Hospitals are not excluded in record
keeping. The records kept include patient data, which
help to maintain patient’s medical records.
TABLES USED IN DATABASE
 Patients table
 Doctors table
 Specialization table
 Ward table
 Disease table
QUERIES USED
 Insert into
 Delete row
 Update
 Alter
 Add colum
 Delete column
 Rename column
 Joining
 FK constraint
 PK constraint
 CHECK constraint
CREATE TABLE PATIENTS
 create table patients
(patient_no number(5) not null,name varchar(20)not
null,father_name varchar(20)not null,age
number(3),address varchar(20),gender
varchar(20),admitt_date date, dischar_date
date,fee_paid number (10)not null,nic varchar(20));
ADD COLUMN
 Alter table patients
add(Ward_No, Dr_Name varchar(30),Disease_No
varchar(30));
CONSTRAINTS IN PATIENTS TABLE
 alter table patients
add(constraint patient_pk PRIMARY
KEY(Patient_No));
 alter table patients
add(constraint wardp_fk FOREIGN
KEY(Ward_No)references Ward(Ward_No));
 alter table patients
 add constraint nic_unique UNIQUE (nic);
 alter table patients
add(constraint disease_fk FOREIGN
KEY(Disease_No)references
Disease(Disease_No));
 alter table patients
add constraint check_gender CHECK(gender
IN('F','M'));
UPDATE THE PATIENTS TABLE
 set update patients
disease_no='3'
where patient_no=4;
DELETE THE ROW FROM PATIENTS
 delete from patients
where patient_no=2;
DELETE COLUMN & RENAME
 Alter table patients
DROP column Age;
 Rename the column
 alter table patients
rename column feepaid to Fees_Paid;
JOINING
 select p.name,d.name
from patients p,doctors d
where p.patient_no=d.ward_no;
Result
DOCTORS TABLE
 Create table doctors
(name varchar(30)not null,duty_time
varchar(20),shift varchar(20),time
varchar(20),Ward_No number (2),Specialist_No
varchar(5));
CONSTRAINTS USED IN DOCTORS TABLE
 alter table doctors
add(constraint ward_fk FOREIGN
KEY(Ward_No)references Ward(Ward_No));
 alter table doctors
add(constraint special_fk FOREIGN
KEY(Specialist_No)references
specialization (Specialist_No));
 alter table doctors
add constraint check_shift CHECK(shift IN(‘E','M'));
INSERT, UPDATE,DELETE IN DOCTORS
 insert into doctors
values('Ali','8:30to2:30','M','null','No',1,'p2');
 delete from doctors
where name='Ali'
 update doctors
set name='Ali Hydar'
where name='Ali'
DOCTORS TABLE
CREATE WARD TABLE
 Create table ward
(ward_No number (2),ward_name varchar(20));
 alter table ward
add (constraint wardNo_pk PRIMARY KEY
(ward_no));
 alter table ward
add (constraint wardName_unique UNIQUE
(ward_name));
INSERT,UPDATE,DELETE WARD
 insert into ward
values(1,'Surgery');
update ward
set ward_name='Daignostic'
where ward_no=1
delete from ward
where ward_no=1;
WARD TABLE
CREATE SPECIALIZATION TABLE
 Create table specialization
(specialist_No varchar(20),specialization_In
varchar(30));
Alter table specialization
add(constraint specialist_pk PRIMARY
KEY(Specialist_No));
INSERT INTO SPECIALIZATION
 insert into specialization
values('p1','paediatrics');
SPECIALIZATION TABLE
DELETE ROW FROM SPECIALIZATION
delete from specialization
where specialist_no='p1'
UPDATE SPECIALIZATION
 update specialization
set specailization_in='psycatrist'
where specialist_no='p2'
DISEASE TABLE
Alter table Disease
add(constraint disease_pk PRIMARY
KEY(Disease_No));
INSERT ,UPDATE IN DISEASE
 insert into disease
values(1,'fever');
 update disease
set disease_name='null'
where disease_no=10;
DELETE ROW FROM DISEASE
 delete from disease
where disease_no=1;

sasui73_DataBase_ASSIGNMENT

  • 1.
    HOSPITAL MANAGEMENT SYSTEM SasuiHidatyatullah lohar 2k12/BsIt/73 University of Sindh jamshoro
  • 2.
     As weknow that the manual system is too much difficult to handle the record in our daily life. In the present era of globalization and advanced technology efficient record keeping cannot be overemphasized. Imagine the scenario when the manual processes and manual modes of instruction get replaced with electronic systems. One of such replacement can be done in the area of patient’s database management system within a hospital. Developing patient database management system software would benefit the hospital management who can have effortless access to the data securely and more easilsy.Hospitals are not excluded in record keeping. The records kept include patient data, which help to maintain patient’s medical records.
  • 3.
    TABLES USED INDATABASE  Patients table  Doctors table  Specialization table  Ward table  Disease table
  • 4.
    QUERIES USED  Insertinto  Delete row  Update  Alter  Add colum  Delete column  Rename column  Joining  FK constraint  PK constraint  CHECK constraint
  • 5.
    CREATE TABLE PATIENTS create table patients (patient_no number(5) not null,name varchar(20)not null,father_name varchar(20)not null,age number(3),address varchar(20),gender varchar(20),admitt_date date, dischar_date date,fee_paid number (10)not null,nic varchar(20));
  • 6.
    ADD COLUMN  Altertable patients add(Ward_No, Dr_Name varchar(30),Disease_No varchar(30));
  • 7.
    CONSTRAINTS IN PATIENTSTABLE  alter table patients add(constraint patient_pk PRIMARY KEY(Patient_No));  alter table patients add(constraint wardp_fk FOREIGN KEY(Ward_No)references Ward(Ward_No));  alter table patients  add constraint nic_unique UNIQUE (nic);
  • 8.
     alter tablepatients add(constraint disease_fk FOREIGN KEY(Disease_No)references Disease(Disease_No));  alter table patients add constraint check_gender CHECK(gender IN('F','M'));
  • 9.
    UPDATE THE PATIENTSTABLE  set update patients disease_no='3' where patient_no=4;
  • 10.
    DELETE THE ROWFROM PATIENTS  delete from patients where patient_no=2;
  • 11.
    DELETE COLUMN &RENAME  Alter table patients DROP column Age;  Rename the column  alter table patients rename column feepaid to Fees_Paid;
  • 12.
    JOINING  select p.name,d.name frompatients p,doctors d where p.patient_no=d.ward_no; Result
  • 13.
    DOCTORS TABLE  Createtable doctors (name varchar(30)not null,duty_time varchar(20),shift varchar(20),time varchar(20),Ward_No number (2),Specialist_No varchar(5));
  • 14.
    CONSTRAINTS USED INDOCTORS TABLE  alter table doctors add(constraint ward_fk FOREIGN KEY(Ward_No)references Ward(Ward_No));  alter table doctors add(constraint special_fk FOREIGN KEY(Specialist_No)references specialization (Specialist_No));  alter table doctors add constraint check_shift CHECK(shift IN(‘E','M'));
  • 15.
    INSERT, UPDATE,DELETE INDOCTORS  insert into doctors values('Ali','8:30to2:30','M','null','No',1,'p2');  delete from doctors where name='Ali'  update doctors set name='Ali Hydar' where name='Ali'
  • 16.
  • 17.
    CREATE WARD TABLE Create table ward (ward_No number (2),ward_name varchar(20));  alter table ward add (constraint wardNo_pk PRIMARY KEY (ward_no));  alter table ward add (constraint wardName_unique UNIQUE (ward_name));
  • 18.
    INSERT,UPDATE,DELETE WARD  insertinto ward values(1,'Surgery'); update ward set ward_name='Daignostic' where ward_no=1 delete from ward where ward_no=1;
  • 19.
  • 20.
    CREATE SPECIALIZATION TABLE Create table specialization (specialist_No varchar(20),specialization_In varchar(30)); Alter table specialization add(constraint specialist_pk PRIMARY KEY(Specialist_No));
  • 21.
    INSERT INTO SPECIALIZATION insert into specialization values('p1','paediatrics');
  • 22.
  • 23.
    DELETE ROW FROMSPECIALIZATION delete from specialization where specialist_no='p1'
  • 24.
    UPDATE SPECIALIZATION  updatespecialization set specailization_in='psycatrist' where specialist_no='p2'
  • 25.
    DISEASE TABLE Alter tableDisease add(constraint disease_pk PRIMARY KEY(Disease_No));
  • 26.
    INSERT ,UPDATE INDISEASE  insert into disease values(1,'fever');  update disease set disease_name='null' where disease_no=10;
  • 27.
    DELETE ROW FROMDISEASE  delete from disease where disease_no=1;