该关系模式可能存在哪些函数依赖?验证给定FD是否适用
First, let’s start with the core business rules we have—these are the foundation for figuring out valid functional dependencies (FDs):
- Every doctor has a unique registration number (
doc-rego), which maps to their first name, surname, gender, and qualification details. - Patients are uniquely identified by
pat-ID, which ties to their given name, surname, gender, date of birth, address, and phone number. - Each appointment between a patient and doctor gets a unique
app-ID, which specifies the appointment’s date/time and type (long or short).
All Valid Functional Dependencies for ABC
Based on those rules, here are all the FDs that apply to the relation:
doc-rego→doc-firstname,doc-surname,doc-gender,doc-qualification
Sincedoc-regois a unique identifier for doctors, knowing this value lets you determine every attribute related to that doctor.pat-ID→pat-givename,pat-surname,pat-gender,pat-DOB,pat-addr,pat-phonepat-IDis the unique patient identifier, so it determines all patient-specific information.app-ID→pat-ID,doc-rego,app-datetime,app-type
Eachapp-IDis one-of-a-kind per appointment, so it links to exactly one patient, one doctor, and the appointment’s datetime/type.
Verification of the Provided FDs
Let’s go through each of the FDs you shared to confirm if they hold:
fd1: doc-rego → doc-firstname, doc-surname
✅ This is valid. Since doc-rego uniquely identifies a doctor, each registration number will always map to the same first name and surname. Note: This FD is incomplete—doc-rego also determines doc-gender and doc-qualification per the given rules—but the stated FD itself is still correct.
fd2: patID → pat-givename, pat-surname, pat-gender, pat-DOB, pat-addr, pat-phone
✅ This is valid (assuming a typo). The relation uses pat-ID (with a hyphen) as the patient’s unique ID. If patID is just a typo for pat-ID, then this FD holds because the patient ID determines all their personal details.
fd3: app-ID → app-datetime, app-type
✅ This is valid. Each app-ID is unique to an appointment, so it will always correspond to exactly one date/time and type. Additionally, app-ID should also determine pat-ID and doc-rego because every appointment is between one patient and one doctor.
内容的提问来源于stack exchange,提问作者user24529

