1.Dormitory management system at a campus

A.create entity and their attributes
B.identify the degree of their relationship
C.identity their cardinalities
D.constraints
E.ER Diagram

1 answer

A. Entities and their attributes:

1. Dormitory:
- Dormitory_ID (primary key)
- Dormitory_Name
- Address
- Capacity

2. Room:
- Room_ID (primary key)
- Dormitory_ID (foreign key)
- Room_Number
- Capacity

3. Student:
- Student_ID (primary key)
- Room_ID (foreign key)
- Name
- Gender
- Contact_Number

B. Degree of Relationship:

- Dormitory and Room have a one-to-many relationship. Each dormitory can have multiple rooms, but each room belongs to only one dormitory.
- Room and Student have a one-to-many relationship. Each room can accommodate multiple students, but each student belongs to only one room.

C. Cardinalities:

- Dormitory (1) <-------- (1 to many) Room
- Room (1) <-------- (1 to many) Student

D. Constraints:

- Dormitory_ID in Dormitory is unique and cannot be null.
- Dormitory_Name in Dormitory cannot be null.
- Address in Dormitory cannot be null.
- Capacity in Dormitory must be a positive integer.

- Room_ID in Room is unique and cannot be null.
- Dormitory_ID in Room is a foreign key referencing Dormitory(Dormitory_ID).
- Room_Number in Room cannot be null.
- Capacity in Room must be a positive integer.

- Student_ID in Student is unique and cannot be null.
- Room_ID in Student is a foreign key referencing Room(Room_ID).
- Name in Student cannot be null.
- Gender in Student cannot be null.
- Contact_Number in Student cannot be null.

E. ER Diagram:

```
+-----------+ +---------+
| Dormitory | | Room |
+-----------+ +---------+
|Dormitory_ID+----+ |Room_ID |
|Dormitory_Na| | |Dormitory|
| me +--+ | |Room_Num |
| Address | | | | ber |
| Capacity | | | | Capacity|
+-----------+ | | +---------+
|
|
|
|
+--------+-------+
| Student |
+----------------+
| Student_ID |
| Room_ID |
| Name |
| Gender |
| Contact_Number |
+----------------+
```