CS3402 Database Systems Tutorials CS3402 Tutorial 1 (Introduction and ER Model):
1. Below are some sample data stored in an Excel file. Identify entity, entity set, attribute, relationship, relationship set in this application.
2. Construct an ER diagram for a car insurance company with a set of customers, each of whom owns a number of cars. Each car has a number of recorded accidents associated with it.
3. Construct an ER diagram for a hospital with a set of patients and a set of medical doctors. A log of the various conducted tests and results is associated with each patient.
CS3402 Database Systems Tutorials
CS3402 Tutorial 1: 1. Answer:
Entity: every single course, each individual student, each instructor
Entity set: the set of students, the set of courses, and the set of instructors Attributes: CourseID, Course Title, Student ID, Student Name, Student Programme, Student Grade (an attribute of a relationship)
Relationship: Dr. J Wang teaching CS3402, Dr. M Li teaching CS2303, student Peter Pan taking course CS2303, student Caption Hook taking course CS3402 …
Relationship set: the set of relationships of which students taking which courses, the set of relationships of which teacher teaching which course
2. Answer:
3. Answer:
CS3402 Database Systems Tutorials
Note the questions (2 & 3) do not contain sufficient information for building the two E/R diagrams. The answers are only samples.
For Q2, it is assumed that some cars in the company do not belong to any customers. An accident may involve more than one car. A car may be owned by more than one customer.
For Q3, a patient may have more than one doctor. Each test has a unique test ID.
To TA:Please explain some key points in Q2&Q3 answers to our students, including weak entity set, identifying relationship, full participation, cardinality constraint, and key attributes.