Subject KeyLinks
Author Anthony Tanas
I'm still not understanding key links very well. Please let me go through
an example.

BTW, I'm following Helen's advice on converting WHERE clause joins with
explicit joins when I come across them. I had mainly used where clause
joins to this point.

Example:

SELECT
A.AppointmentTime,
P.LastName,
P.LastName || ', ' || P.FirstName /*|| ' ' || P.MiddleInitial*/
PatientName,
P.ChartID,
P.HomePhone,
'Dr. ' || D.LastName DoctorName,
A.Notes,
APT.AUTOCOLOR
FROM
Appointment A
INNER JOIN PATIENT P ON (A.PATIENTID = P.PATIENTID)
INNER JOIN DOCTOR D ON (A.DOCTORID = D.DOCTORID)
LEFT JOIN APPOINTMENTTYPE APT ON (A.TYPEDESCRIPTION = APT.TYPEDESCRIPTION)
WHERE
A.AppointmentDate = :AppointmentDate
ORDER BY
A.AppointmentTime,
P.LastName

In this query there are no primary keys in the select. So I should use the
actual primary keys for the table?

So KeyLinks whould be:

APPOINTMENT.APPOINTMENTID

That would uniquely identify each record, but Helen said I need ALL of the
primary keys of the underlying table so would my keylinks then be:

APPOINTMENT.APPOINTMENTID
PATIENT.PATIENTID
DOCTOR.DOCTORID
APPOINTMENTTYPE.TYPEDESCRIPTION

Those are my primary keys on those tables.

In the KeyLinks demo program there was something like:

CUSTOMER.ORDERID = ORDER.ORDERID

I'm not sure I understand what this means as the query was a simple select
(select * from customer) in the demo app.

Also I still don't understand why this is necessary because it's working
without the key links?