I'm confused what the NextOfKinPerID refers to based on this query. can you explain what…
- User
I'm confused what the NextOfKinPerID refers to based on this query. can you explain what it is? maybe suggest a better column name?
SELECT * FROM Patient AS pat INNER JOIN Person AS p on pat.PersonID = p.PersonID LEFT OUTER JOIN NextOfKin AS nok ON p.PersonID = nok.PersonID LEFT OUTER JOIN Person AS nokp ON nok.NextOfKinPerID = nokp.PersonID
- Assistant
The
NextOfKinPerIDin this query refers to the PersonID of the next of kin for each patient. The column name stands for "Next Of Kin Person ID". In this query, the database tablesPatient,Person,NextOfKin, and another instance ofPerson(aliased asnokp) are being joined together to retrieve information about a patient, their next of kin, and related person details.A suggested better column name for
NextOfKinPerIDmight beNextOfKinPersonIDas it is more self-explanatory.