You're a report developer at a clinic. The patient wristband printing system needs a single field containing the patient's full name: last name, first name, and middle name (if present), separated by single spaces. Some patients have no middle name (NULL), and the wristband must not contain double or trailing spaces. The admissions scanner compares names character by character.
Return these columns:
- patient_id — the patient ID (integer);
- full_name — a string in the format 'LastName FirstName MiddleName', with exactly one space between names. If the middle name is missing, omit it without leaving a trailing space.
Sort by full_name in ascending order, breaking ties by patient_id in ascending order. Return all patients.
patient_idfull_nameShowing the first 3 rows of the sample — the full sample comes with Premium
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in