Problem #2 from page 173

Given the following business scenario, create a Crow’s Foot ERD using a specialization hierarchy if appropriate. Tiny Hospital keeps information on patients and hospital rooms. The system assigns each patient a patient ID number. In addition, the patient’s name and date of birth are recorded. Some patients are resident patients (they spend at least one night in the hospital) and others are outpatients (they are treated and released). Resident patients are assigned to a room. Each room is identified by a room number. The system also stores the room type (private or semiprivate), and room fee. Over time, each room will have many patients that stay in it. Each resident patient will stay in only one room. Every room must have had a patient, and every resident patient must have a room.

I'm looking for the answer also.

To solve this problem, we will create a Crow's Foot ERD (Entity-Relationship Diagram) using a specialization hierarchy.

1. Identify the entities:
- Patient
- Room

2. Identify the attributes for each entity:
Patient entity:
- Patient ID (primary key)
- Name
- Date of Birth

Room entity:
- Room Number (primary key)
- Room Type
- Room Fee

3. Determine the relationships between the entities:
- Each patient may be either a resident patient or an outpatient.
- Resident patients are assigned to a room.
- Each room can have many patients staying in it.
- Each resident patient stays in only one room.
- Every room must have had a patient, and every resident patient must have a room.

4. Create the specialization hierarchy:
- Create a supertype entity "Patient" and two subtype entities "Resident Patient" and "Outpatient." Connect the subtypes to the supertype using a specialization relationship.

5. Add relationship and cardinality notation:
- Add a one-to-many relationship between Room and Resident Patient. Connect the relationship using a line. Place "1" near the Room side and "0,1" near the Resident Patient side to represent that each room has zero or one resident patients staying in it.
- Add a one-to-many relationship between Room and Outpatient. Connect the relationship using a line. Place "0,N" near the Outpatient side to represent that each room can have multiple outpatients treated and released.
- Add a one-to-one relationship between Resident Patient and Room using a straight line. Place "1" near the Resident Patient side and "1" near the Room side to represent that each resident patient stays in one room.
- Finally, indicate the mandatory participation between Room and Resident Patient by placing a straight line near the Resident Patient side with an arrow pointing towards Room.

6. Finalize the diagram:
- Add attribute names above the entity boxes and relationship names near the relationship lines.
- Identify the primary key attributes by underlining them.

The completed Crow's Foot ERD should reflect the relationships and attributes discussed above.