0% found this document useful (0 votes)
22 views1 page

DBMS Mysql Notes

The document shows the creation of four tables - Doctor, Patient, Visit, and Bill - to store information about doctors, patients, visits, and bills in a database management system. It also creates a function to return the name of a patient based on their blood group.
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)
22 views1 page

DBMS Mysql Notes

The document shows the creation of four tables - Doctor, Patient, Visit, and Bill - to store information about doctors, patients, visits, and bills in a database management system. It also creates a function to return the name of a patient based on their blood group.
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/ 1

DBMS

create table Doctor(doctor_id int primary key, doc_name varchar(30), specialized_in varchar(30),
gender varchar(1));

create table Patient(patient_id int primary key, patient_name varchar(30), birth_date date, gender
varchar(1), blood_group varchar(5), case_id int);

create table Visit(doctor_id int references doctor(doctor_id), patient_id int references


patient(patient_id), date_of_visit date, problem varchar(30), diagnosis varchar(30),
treatement_suggested varchar(30), next_visit_date date);

create table Bill(doctor_id int references Doctor(doctor_id), patient_id int references


Patient(patient_id), bill_date date, total_amount int);

create function getPatientName(blood_group varchar(5))

returns table(patient_name varchar(30))

return table

(select patient_name from patient where patient.blood_group=getPatientName(blood_group));

You might also like