Oldest and Youngest Employees
Problem statement
The employees table contains each employee's full name and date of birth. Return the full name and date of birth of every oldest employee and every youngest employee.
The oldest employees have the earliest date of birth; the youngest employees have the latest date of birth. Include everyone tied at either extreme. Combine the two groups with UNION ALL semantics, so a row appears twice if it belongs to both groups.
Return exactly two columns, FULL_NAME followed by DATE_OF_BIRTH. Row order does not matter.
Table schema
Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.
employees
| Column | Type | Nullable | Description |
|---|---|---|---|
| full_name | Text | No | — |
| date_of_birth | Date | No | — |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| FULL_NAME | Text | No | — |
| DATE_OF_BIRTH | Date | No | — |
Row order: any order is accepted. Numeric tolerance: 0.
Constraints
- The table contains at least one employee.
- Every
full_nameis non-empty and everydate_of_birthis a known date.