Problem · Database
Null-Safe Full Name
Problem statement
The table people contains one row per person. Return person_id and a full_name made from first_name, middle_name, and last_name.
Skip every NULL name part and join the remaining parts with exactly one ASCII space. Return every person in ascending person_id order.
Table schema
MySQLPostgreSQLPandas
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.
people
One row per person.
| Column | Type | Nullable | Description |
|---|---|---|---|
| person_idPK | Integer | No | — |
| first_name | Text | No | — |
| middle_name | Text | Yes | — |
| last_name | Text | Yes | — |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| person_id | Integer | No | — |
| full_name | Text | No | — |
Row order: must match exactly. Numeric tolerance: 0.
Constraints
1 <= people.length <= 200000person_idis unique.first_nameis non-NULL.- Every non-NULL name part is non-empty, contains at most 100 characters, and has no leading or trailing whitespace.
More infosys problems
- Swap Two Numbers Without a Third VariableONSITE INTERVIEW · Seen Aug 2026
- Count Valid A-B-C Sequences Under a Modulo-Four RuleOA · Seen Aug 2026
- Maximum Product of a Strictly Increasing Contiguous SubarrayOA · Seen Aug 2026
- Minimum Cost to Assign Candidates to Two CitiesOA · Seen Aug 2026
- Merge Two Sorted Arrays In PlaceONSITE INTERVIEW · Seen Jul 2026
- Minimum Coins for a TargetONSITE INTERVIEW · Seen Jul 2026
- Sort Sentence WordsONSITE INTERVIEW · Seen Jul 2026
- Minimum Path Sum With Grid SwitchesONSITE INTERVIEW · Seen May 2026