0% found this document useful (0 votes)
7 views2 pages

Entity-Relationship Model Exercises

The document contains exercises related to creating entity-relationship diagrams for various applications, including industrial factories, educational institutions, and healthcare systems. Each exercise outlines specific requirements for entities, attributes, and relationships that need to be represented in the diagrams. The exercises aim to enhance understanding of the entity-relationship model in different contexts.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Entity-Relationship Model Exercises

The document contains exercises related to creating entity-relationship diagrams for various applications, including industrial factories, educational institutions, and healthcare systems. Each exercise outlines specific requirements for entities, attributes, and relationships that need to be represented in the diagrams. The exercises aim to enhance understanding of the entity-relationship model in different contexts.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Chapter 2.

Entity-Relationship Model

Exercise 1
Describe the entity relationship diagrams given in the following figures.

Exercise 2
Draw an entity relationship diagram for the following application in an industrial factory:
• There can be many suppliers
• Each supplier has a unique name
• Each supplier can supply many parts to the factory. Each part can be supplied by many
suppliers
• Each part has a unique part number
• Each part has a color
• A supplier can only supply a fixed quantity of each part

Exercise 3
Consider the Teach relationship between Teachers and Subjects. For each of the following
situations, draw an entity relationship diagram
• Each teacher teaches only one Subject
• Each teacher must teach several Subjects
• Each teacher teaches only one Subject, and every subject must be taught by several
teachers
• Teachers can teach the same Subject in many semesters, and need to keep records of all
teaching semesters
• Teachers can teach the same Subject in many semesters, but only need to keep records of
the current semester
• A Subject can be taught by a group of Teachers
Additional attributes, entities, and relationships may be used as needed

Source: Bài giảng Nguyễn Kim Anh. [Link]


cdf95d7e8db7@1
Exercise 4
Define an entity relationship diagram for a university management database, which stores
information about Departments, Institutes, Lecturers, Students, Subjects, Classes, Buildings,
Rooms, and Scores. The model should store the following information:
• For each Institute: Name, Address, Institute Head, list of Staff
• For each Department: Name, Affiliated Institute, Department Head
• For each Lecturer: Name, Date of Birth, Position, Lecturer Code, Institute, Office Room,
List of Subjects, List of Classes
• For each Student: Name, Date of Birth, Student Code, list of Subjects studied, scores for
subjects studied
• For each Subject: Subject Code, Subject Name, Semester, list of Lecturers, list of
Students, list of Classes
• For each Class: Class Type (Theory, Practice, Self-Study), Start/End Date, Class Time,
Lecturer, list of Students, Location
• For each Building: Name, Corresponding Map
• For each Room: Name, Capacity, Room Type (Office, Lecture Hall, Laboratory, Practice
Room), Building Name.
Assumption: Lecturers teach the subjects they have registered for. They can teach different
classes of the same subject. And each class is taught by only one Lecturer.

Exercise 5
Define an entity relationship diagram to describe the following database:
• Patients are identified by an SSN. The patient's name, address, and age need to be
recorded.
• Doctors are identified by an SSN. For each doctor, the name, specialty, and years of
experience need to be recorded.
• Each Pharmacy has a name, an address, and a phone number. Each Pharmacy has a
manager.
• Pharmacists are identified by an SSN. Pharmacist can only work in one pharmacy. For
each pharmacist, the name and qualifications need to be recorded.
• For each type of drug, the name, manufacturer, and dosage need to be recorded.
• Each pharmacy can sell many types of drugs, each with its own price. A drug can be sold
at many pharmacies, and the price varies between pharmacies.
• Doctors prescribe drugs to patients. A patient can receive many prescriptions from many
doctors. A prescription can contain one or more medications. Each prescription has a date,
and the corresponding medication type and quantity.

Source: Bài giảng Nguyễn Kim Anh. [Link]


cdf95d7e8db7@1

Common questions

Powered by AI

Entity-relationship diagrams manage complex interactions by clearly defining entities such as 'Lecturer', 'Student', 'Subject', and 'Class'. Each of these entities would have specific attributes, e.g., 'Lecturer' could have 'Name', 'Lecturer Code', and 'Office Room'. Interactions are managed by establishing relationships like 'Lecturer' teaching 'Subject' and 'Student' enrolling in 'Class'. Additional linking entities might be needed to monitor which lecturers teach which classes and subjects, and which students take these subjects, ensuring that each relationship maintains its integrity across multiple instances and interrelations .

To handle institutional changes like staff turnover, the diagram should incorporate a robust entity for 'Teaching Assignment' that could dynamically connect 'Teacher', 'Subject', and 'Semester' entities. Using such intermediary entities allows flexible tracking of assignments over time and ensures historical records are retained. Adding attributes like 'Start Date' and 'End Date' for assignments provides temporal tracking. Implementing a status attribute indicative of current versus past roles can assist in maintaining focus on current staffing, while still allowing access to archival data for turnover analysis and institutional reporting .

Optimization involves defining distinct entities like 'Room', characterized by 'Name', 'Capacity', and 'Room Type'. There's a need for relationships connecting 'Room' with 'Class', wherein 'Class' details include attributes like 'Class Type'. Types of rooms such as 'Lecture Hall', 'Laboratory', or 'Practice Room' may require unique associations based on their support for different class types. This ensures accurate allocation and avoids scheduling conflicts. Attributes of 'Building' as another entity can support logistical tracking, aiding in optimization of classroom utilization based on proximity and course requirements .

Effective modeling involves defining detailed entities 'Lecturer', 'Student', 'Class', and 'Subject', capturing attributes like 'Capacity' in 'Class' to manage enrollment limits. Relationships should track 'Lecturer' assignments to specific 'Classes', while 'Student' entities are linked through 'Participation' relationships to 'Class'. Ensuring synchronization of schedules across entities reduces conflicts. Introducing a 'Timetable' entity or attribute to each class allows for structured oversight, helping align lecturer availabilities to class schedules. Capacity constraints are managed by checking against 'Room' entity capacities, ensuring logical consistency and operational feasibility .

Complexities in designing an entity-relationship diagram for a pharmacy system include managing various interactions such as 'Doctors' prescribing medications, 'Patients' receiving multiple prescriptions, and medications being sold at differing prices across 'Pharmacies'. Multiple relationships such as 'Doctor-Prescription' and 'Patient-Prescription' need to be represented, potentially with entities like 'Prescription' linking them. The variability in pricing strategies among pharmacies for the same medication adds complexity, requiring an association that records prices specific to pharmacies. Accurately reflecting these dynamic and numerous interactions demands careful planning of relationships and entities .

An entity-relationship diagram can represent patients, doctors, and pharmacies by defining entities like 'Patient' with attributes 'SSN', 'Name', and 'Address', and 'Doctor' with 'SSN', 'Name', and 'Specialty'. 'Pharmacy' entities would include 'Name' and 'Address'. Relationships such as 'Doctor-Prescription' link doctors to prescriptions with attributes 'Date' and 'Medication Type', while the 'Patient-Prescription' relationship connects patients to their prescriptions. A 'Pharmacy-Prescription' relationship can address the dispensing of drugs, reflecting how varied prices are managed across pharmacies. Associations should include all required interrelated data points to maintain comprehensive management and tracking of prescriptions .

The key challenges lie in accurately reflecting the temporal aspect of teaching assignments over different semesters and ensuring flexibility in role allocations. For instance, an entity 'Semester' can be introduced to link 'Teacher' and 'Subject', facilitating the recording of teaching activities over multiple semesters. It's crucial to decide whether to maintain records for all semesters or just the current one. Another challenge is allowing groups of teachers to teach the same subject, typically requiring associations or reliance on group entities. Ensuring the model can handle both individual and group teaching scenarios is essential to meeting diverse requirements .

To manage patient prescriptions, pharmacy sales, and drug inventory, separate entities like 'Patient', 'Prescription', 'Pharmacy', 'Drug', and 'Inventory' should be established. 'Prescription' links 'Patient' to 'Doctor' and 'Medication', encapsulating details like quantity and date. 'Pharmacy' links with 'Inventory' and 'Drug' to handle stock and sale aspects. Relationships must reflect dynamic stock levels and varied pricing strategies across different pharmacies. Accurate and real-time stock status can be maintained with update triggers upon sale or prescription fulfillment, ensuring synchronization between prescription issuance and inventory availability .

The entity-relationship diagram should include entities such as 'Supplier' and 'Part', each with their unique identifiers like 'Supplier Name' and 'Part Number', respectively. There should be a many-to-many relationship between 'Supplier' and 'Part', indicating that each supplier can supply multiple parts and each part can be supplied by multiple suppliers. To resolve this many-to-many relationship, an associative entity such as 'Supply' can be introduced, which will include the fixed quantity each supplier supplies for each part .

To accommodate both individual and grouped teacher assignments for a subject, the entity-relationship diagram might include a 'Group' entity to which both subjects and multiple teachers can be associated. This structure allows for flexibility in modeling different teaching arrangements, whether a single teacher or a group of teachers covers a subject. Such a diagram would also need to address potential overlaps and ensure that group membership and teaching history are clearly traceable .

You might also like