The patient name on the wristband

The patient name on the wristband

You are a reports developer at a clinic. The patient wristband printer needs a single field with the full name: last name, first name and — when present — the middle name, separated by single spaces. Some patients have no middle name (NULL), and the band must contain no double or trailing spaces: the admissions scanner compares the name character by character. Return columns: - patient_id — patient id (integer); - full_name — a string of the form 'Lastname Firstname Middlename' with a single space as separator; when the middle name is missing it simply does not participate (no stray trailing spaces). Sorting: by full_name ascending, identical names ordered by patient_id ascending. Return all patients.

Exemplo de resposta esperada

É assim que se parece uma resposta correta: ela tem seu próprio número de linhas e não precisa coincidir com as tabelas do esquema. Sua resposta precisa retornar os mesmos nomes de colunas do exemplo: use AS para renomeá-las se for preciso.

patient_idfull_name
4Bauer Chris
10Costa Bruno Miguel
7Hansen Freja
PostgreSQLv16
Entre para enviar

O resultado da sua consulta aparecerá aqui

Focus radio
Paused · SomaFM · Fluid