You are on page 1of 4

Database Report

 The people table contains all the people and their common attributes.
There are 3 subtypes for the people table: patient, donor, nurse.
 The doner table contains the information required to be a donor:
blood type, weight, height, gender.
 The patient table contains all the patients and their information
required before a blood transfusion. The need status: high priority or
low priority.
 The nurse table contains all the nurses with the years of experience
they have.
 The donation table contains the basic attributes about a blood
donation. The donation type references the type of blood donation.
 The donation type table contains the types of blood donation and the
waiting time before donating that type again.
 The transfusion table contains the basic attributes about a blood
transfusion.
 The pre-Exam table contains information about a donor before
donation as well as a patient before a transfusion.

LDM
People
Patient PID Pre-exam
PID # FIRSTNAME
PEID
Blood-type LASTNAME
Hemoglobin
Need-status AGE
Blood-type
Weight Temperature
Pulse-rate

Doner Nurse
PID # PID #
Blood-type
DONATION-TYPE Transfusion
Years-experimented Donation
Weight DID
TYPE
Height TID
Frequency-days PID # Amount donated
Gender
PEID # PID #
Amount_ received Donation-type
PEID #

QUERIES:
1) Select people that have a pid bigger than 6.

SELECT *
FROM people
WHERE pid>6;
2) Find the bloodtype and the PID of patient where their needstatus is high
and their age is above 50.
SELECT bloodtype, PID
FROM patient
WHERE needstatus=’high’ And PID IN (SELECT PID
FROM People
WHERE age>50);
3) Select the firstname and lastname of people where people id is equal
to donor id and the donor bloodtype is equal to B-.
SELECT firstname, lastname

FROM people, donor

WHERE people.pid=donor.pid

AND donor.bloodtype='B-';

4) Select all the information of the nurse that have an age bigger or equal to 40.
SELECT *

FROM nurse

WHERE pid IN (SELECT pid

FROM people

WHERE age>=40);

5) Select the first name and last name of people that have an age between 10 and
20 years old.
SELECT firstname, lastname

FROM People

WHERE age BETWEEN 10 AND 20;

6) Select the first name last name and age from the table people and put them in
order from the youngest to the oldest.
SELECT Firstname, Lastname, age

FROM people

ORDER BY age;

You might also like