Good question, if you loaned a device to a student that device would be deleted because it is old, do you want to delete that the loan ever existed?
Now, this is where “It's part of” gets a little complicated in this specific scenario. It's tempting to think that “Pay” should be “part of” “students” or “Devices.” However, a payment record really depends on both a student and a device.
Here's why using “It's part of” for “Pay” may not be ideal:
- Data integrity: If “Pay” is “part of” “Students”, deleting a student would delete their payment records. This means you will lose the history of which devices they reviewed. The same problem arises if “Pay” is “part of” “Devices”.
- Logical relationship: A payment is not actually “owned” by either the student or the device. It represents a temporary association between the two.
A better approach:
Instead of “It is part of”, use regular references (Ref) in your “Pay” table:
- Student ID (Ref): This column references the “Students” table, linking each payment record to a specific student.
- Device ID (reference): This column references the “Devices” table, linking each payment record to a specific device.
How does this work:
- Clear links: Your “Payment” table clearly shows which student has checked out which device.
- Data preservation: Deleting a student or device will not automatically delete payment records. You keep payment history.
- Flexibility: You can easily add more details to the “Payment” table, such as payment date, due date, and return date.
AppSheet is part of:
While “It's part of” is useful for parent-child relationships, the payment app on your device requires a more balanced relationship between the three tables. Using references (Ref) provides the flexibility and data integrity you need for this scenario.