Amar Saleh Week#2
Class:CIS23
Professor:Emma
Date 7/6/2025
Task1 E-R diagram-university (15 points)
Scenario: for a database for a university, let us assume that we want to keep
information about students, the classes they are enrolled in, the faculty who
teach those classes.
Requirement:
1.a (10 points). Create an E-R/UML diagram to show how the entity sets and the
relationship to other entity sets would be represented and include attributes.
Indicate primary keys. Stating any necessary assumptions, make a decision
about the cardinality and participation constraints of the relationship, and add
appropriate symbols to the E-R diagram.
1.b (5 points). Based on task1.a, we also want to include the textbooks used,
represent departments that employ the faculty members, and show the
relationship between department and students. Making up attributes as needed,
add the entity sets and appropriate relationship(s) to the E-R diagram.
Entities and Attributes:
Task #1 1-A
We are designing a database for a university to track:
● Students (with ID, email, name, address)
● Faculty (with ID, name, email, office phone, status)
● Classes (with class time, day of the week, teacher name, class ID)
The relationships are:
● Faculty teach classes.
○ One faculty member can teach many classes (1-to-many), but each class is usually
taught by one faculty member (many-to-1).
● Students attend classes.
○ Many students can attend many classes (many-to-many).
● Each entity has a primary key (like student ID for students, faculty ID for faculty, class ID
for classes).
Participation:
● Students must attend classes (total participation)
● Classes must have faculty assigned (total participation)
● Faculty can exist without teaching a class (partial participation).
1.b. Task I just expand the diagram
I expanded the model to also show:
● Textbooks, with attributes like ISBN and name
Textbooks are used by classes (many-to-many: a class can have many
textbooks, and a textbook can be used in many classes).
● Departments, with attributes like department ID, name, office number, fax
number
○ Departments employ faculty (1-to-many: a department has many faculty,
but faculty usually belong to one department).
○ Students major in departments (many-to-1: many students major in one
department).
So I added:
● A uses relationship between classes and textbooks
● An employed by relationship between faculty and departments
● A major in relationship between students and departments
Primary keys:
● Textbook: ISBN
● Department: department ID
● Student: student ID
● Faculty: faculty ID
● Class: class ID
Participation/Constraints:
Each class we used at least one textbook (total participation on class side)
Each faculty member must belong to one department (total participation for faculty,
partial for department)
Each student majors in one department (total participation on student side)
Step 1 Task2:: Draw the Entities and Attributes
We will start with rectangles for entities, and ovals for their attributes, marking primary
keys clearly.
Entities
PATIENT
● Patient_ID (PK)
● Name
● DOB
● Address
● Phone
PHYSICIAN
● Physician_ID (PK)
● Name
● Specialty
● Phone
PRESCRIPTION
● Prescription_ID (PK)
● Date_Issued
● Patient_ID (FK)
● Physician_ID (FK)
VISIT
● Visit_ID (PK)
● Date
● Time
Prescription_ID (FK)
● Therapist_ID (FK)
● Treatment_ID (FK)
● Equipment_ID (FK)
THERAPIST
● Therapist_ID (PK)
● Name
● Qualification
TREATMENT
● Treatment_ID (PK)
● Name
● Description
Step 2: I have Define the Relationships and Cardinalities
#PATIENT 1 — PRESCRIPTION
● One patient can have multiple prescriptions
● Each prescription is linked to exactly one patient
PHYSICIAN 1 — PRESCRIPTION
● One physician writes many prescriptions
● Each prescription comes from one physician
# PRESCRIPTION 1 — VISIT
● One prescription covers many visits
● Each visit belongs to exactly one prescription
#THERAPIST 1 — VISIT
● One therapist handles many visits
● Each visit has only one therapist
VISIT 1 — 1 TREATMENT
● Each visit is for one treatment
● One treatment can apply to many visits
VISIT 1 — 1 EQUIPMENT
● Each visit uses one equipment item
● One equipment item can be used in many visits
Task3. Design a relational database schema (10 points)
Design a relational database schema for the data described in task1 (include 1.a and
1.b). Please submit the relational schema using Word Document, not on MySQL
Server.
This is my screenshot for Relational Database Schema that is have
Task4. Design a relational database schema (10 points)
Design a relational database schema for the data described in task2. Please
submit the relational schema using Word Document, not on MySQL Server.
Tables and Schema:
1. PATIENT
- Attributes:
● Patient_ID: Primary Key
● A_NO: Additional Identifier (could be a room number or admission number)
● AorF_Name: Patient's Name
● DOB: Date of Birth
● PHONE: Contact Number
2. PHYSICIAN
● Attributes:
● Physician_ID: Primary Key
● Physician_Name: Name of the Physician
● specialty: Area of Specialization
● phone: Contact Number
3. TREATMENT
● Attributes:
● Treatment_PK: Primary Key
● Description: Details of the Treatment
● Cost: Associated cost
4. **PRESCRIPTION**
Attributes:
● Prescription_PK: Primary Key
● Doctor_PK: Foreign Key referencing Physician (Physician_ID)
● Patient_ID_FK: Foreign Key referencing Patient (Patient_ID)
● Medicine: Prescribed Medicine
5. THERAPIST
Attributes:
● Therapist_PK: Primary Key
● Qualifications: Therapist's Qualifications
● OfficeNum: Office Number
Relationships:
-PATIENT and PHYSICIAN are indirectly linked through PRESCRIPTION which has
Foreign Keys referencing both tables.
THERAPIST: seems to act independently in the current setup, with no direct relationship
to other entities provided, attributes to establish relationships.
TREATMENT: could be linked to either PATIENT or PHYSICIAN depending on context,
probably needing additional foreign keys.