Hospital Data Management
Hospital Data Management
TABLES
Patient table
FIELDS DATATYPES RELATIONSHIP
Pid Varchar(10) Not null
Name Varchar(10) Not null
age int Null
weight int Not null
gender char Null
address Varchar(30) Not null
phoneno Varchar(10) Not null
disease Varchar(10) Null
doctor int Not null
Doctor table
FIELDS DATATYPE RELATIONSHIP
doctor_id int Primary key
dname varchar(10) Not null
dept varchar(15) Not null
Lab table
FIELDS DATATYPE RELATIONSHIP
labno Varchar(5) Primary key
p_id Varchar(5) Not null
weight Int Null
doctor_id Int Foreign key
bdata Date Null
patient_type Varchar(10) Not null
amount Int Not null
Room table
FIELDS DATATYPE RELATIONSHIP
Room_no Varchar(50) Primary key
Room_type Varchar(15) Not null
Rstatus Varchar(10) default
Inpatient table
FIELDS DATATYPE RELATIONSHIP
P_id Varchar(5) Null
Room_no Varchar(50) Null
Date_of_adm date Not null
Date_of_dis Date Not null
labno Varchar(5) Foreign key
Outpatient table
FIELDS DATATYPE RELATIONSHIP
P_id Varchar(5) Primary key
Odate Date Not null
Room_no Varchar(10) Foreign key
Bill table
FIELD DATATYPE RELATIONSHIP
Bill_no Varchar(10) Primary key
P_id Varchar(10) null
Patient_type Varchar(10) Null
Medical_charge Int Null
Room_charge Int Null
Doctor_charge Int Null
No_of_days Int Null
Lab_charge Int Null
Bill Int Null
use patient;
null,
patient;
Insert the values into patient table
insert into patient values('01','chethan',18,60,'m','chintamani','6362412058','fever',02);
select*from patient
Doctor
create database doctor; use
doctor;
select*from lab;
Room
create database room;
Use room;
create table room(
room_no varchar(50) primary key,
room_type varchar(15) not null, rstatus
varchar(10) default'vacant'); desc room;
select*from room;
Inpatient
create table inpatient( p_id
varchar(5), room_no
varchar(50), date_of_adm
date not null, date_of_dis
date not null, labno
varchar(5),
foreign key(labno)references lab(labno));
decs inpatient;
select*from inpatient
Outpatient
create database outpatient;
use outpatient; create table
outpatient( p_id varchar(5)
primary key, odate date not
null, room_no varchar(10),
foreign key(room_no)references room(room_no)); desc
outpatient;
Inserting values into outpatient
insert into outpatient values('p01','2023-09-08','room5');
insert into outpatient values('p02','2023-01-02','room24');
insert into outpatient values('p03','2023-10-12','room4');
insert into outpatient values('p04','2023-09-30','room104');
insert into outpatient values('p05','2023-04-08','room107');
select*from outpatient;
Bill
create database bill;
use bill; create table
bill(
bill_no varchar(10) primary key,
p_id varchar(10), patient_type
varchar(10), medical_charge
int, room_charge int,
doctor_charge int, no_of_days
int, lab_charge int,
bill int); desc
bill;
THANKYOU