Changes between Version 6 and Version 7 of RelationalDesign


Ignore:
Timestamp:
06/25/26 10:52:42 (2 weeks ago)
Author:
223091
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RelationalDesign

    v6 v7  
    88
    99In the corrected ER model v.03, ''has_equipment'' is a many-to-many relationship between Rooms and Equipment with the relationship attribute ''quantity''. Therefore, it is transformed into the relation ''room_equipment''. Similarly, ''requests_equipment'' is a many-to-many relationship between Reservations and Equipment with the relationship attribute ''requested_quantity'', so it is transformed into the relation ''reservation_equipment''.
     10
     11The optional relationship ''includes_room'' between Rooms and Reservations is represented by the nullable foreign key ''room_id'' in the ''reservations'' relation, because a reservation may be equipment-only and may not include a room. The relationship ''makes'' between Users and Reservations is represented by the required foreign key ''user_id'' in ''reservations''. The relationship ''has_approval'' between Reservations and Approvals is represented by the required and unique foreign key ''reservation_id'' in ''approvals'', because one reservation can have at most one approval record.
    1012
    1113=== Relations ===
     
    4951
    5052* room_id is the primary key.
    51 * building_id is required.
     53* building_id is required because each room must belong to exactly one building.
    5254* room_code is required and unique.
    5355* capacity must be greater than 0.
     
    7779)
    7880
     81This relation is created from the M:N relationship ''has_equipment'' between Rooms and Equipment in the corrected ER model v.03. The relationship attribute ''quantity'' becomes an attribute of this relation.
     82
    7983Candidate keys:
    8084
     
    8993
    9094* (room_id, equipment_id) is the composite primary key.
     95* room_id is required.
     96* equipment_id is required.
    9197* quantity is required and must be greater than 0.
    92 
    93 This relation is created from the M:N relationship has_equipment between Rooms and Equipment. The relationship attribute quantity becomes an attribute of this relation.
    9498
    9599'''users'''(
     
    129133
    130134* reservation_id
    131 * (room_id, reservation_date, start_time, end_time) for room-based reservations
     135* (room_id, reservation_date, start_time, end_time) for exact room-based reservation intervals
    132136
    133137Foreign keys:
     
    140144* reservation_id is the primary key.
    141145* room_id is optional because equipment-only reservations are allowed.
    142 * user_id is required.
     146* user_id is required because each reservation must be created by exactly one user.
    143147* reservation_date is required.
    144148* start_time is required.
     
    147151* (room_id, reservation_date, start_time, end_time) is unique for exact room reservation intervals.
    148152
     153The uniqueness constraint on (room_id, reservation_date, start_time, end_time) prevents duplicate reservations for the exact same room and time interval. General overlapping intervals are treated as a business rule and are checked by the application/prototype logic. A stricter database-level implementation can be added later using a trigger or exclusion constraint if required.
     154
    149155'''reservation_equipment'''(
    150156'''reservation_id''' PK, FK,
     
    153159)
    154160
     161This relation is created from the M:N relationship ''requests_equipment'' between Reservations and Equipment in the corrected ER model v.03. The relationship attribute ''requested_quantity'' becomes an attribute of this relation.
     162
    155163Candidate keys:
    156164
     
    165173
    166174* (reservation_id, equipment_id) is the composite primary key.
     175* reservation_id is required.
     176* equipment_id is required.
    167177* requested_quantity is required and must be greater than 0.
    168178
     
    190200* approval_id is the primary key.
    191201* reservation_id is required and unique, because one reservation can have at most one approval record.
    192 * approver_id is required.
     202* approver_id is required because each approval decision must be created by exactly one authorized user.
    193203* decision is restricted to the values: approved, rejected.
    194204* decision_time is required.