Reported September 2026
Intuit

Oldest and Youngest Employees

Reported by candidates from Intuit's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Intuit OA. Under 2s to a working solution.
Founder's read

The detail that trips people here is the UNION ALL clause. Intuit reported this SQL question in September 2026, and it looks like a two-line query until you notice a row can land in both groups and has to show up twice. That happens when every employee shares one birth date, or the table has a single row. The task is simple: find everyone tied for the earliest date of birth, find everyone tied for the latest, and stack the two results. If you blank on the syntax mid-assessment, StealthCoder runs invisibly on your screen as a safety net and hands you the query.

The problem

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.

Tables
employees: full_name (Text), date_of_birth (Date)

Constraints
The table contains at least one employee.
Every full_name is non-empty and every date_of_birth is a known date.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is to compute MIN(date_of_birth) and MAX(date_of_birth) in subqueries and filter on them. Select full_name AS FULL_NAME and date_of_birth AS DATE_OF_BIRTH where date_of_birth equals (SELECT MIN(date_of_birth) FROM employees), then UNION ALL the same select against MAX. The pitfall is using LIMIT 1 or ORDER BY with TOP 1, which drops ties. The second pitfall is plain UNION, which dedupes and breaks the spec when one row is both oldest and youngest. Window functions like RANK work too, but they're overkill here. Keep the column names and order exactly as stated, since the output needs two columns only. NULL handling isn't a concern because the constraints say every date is known. If you freeze during the live OA, StealthCoder can supply the query while you confirm the UNION ALL detail.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

If this hits your live OA

You can drill Oldest and Youngest Employees cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Intuit's OA.

Intuit reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Oldest and Youngest Employees FAQ

What's the trick in the Intuit Oldest and Youngest Employees question?+

Use MIN and MAX on date_of_birth in subqueries, filter the employees table against each, and combine with UNION ALL. Ties come along for free because you filter by equality, not by taking one row. The spec demands UNION ALL so duplicates survive.

Why not just use UNION?+

UNION removes duplicate rows. If one employee is both oldest and youngest, which happens with a single-row table or all identical birth dates, the spec wants that row twice. Plain UNION would return it once and fail the hidden test.

Can I use ORDER BY with LIMIT instead?+

Not safely. LIMIT 1 returns one row, but the question wants every employee tied at either extreme. You'd lose ties. Equality against MIN or MAX in a subquery keeps all of them.

Could I use window functions like RANK?+

Yes. Rank by date_of_birth ascending and descending, keep rank 1 in each, then UNION ALL. It works and handles ties, but the MIN/MAX subquery version is shorter and easier to get right under time pressure.

How do I prepare for this in 48 hours?+

Write the MIN/MAX plus UNION ALL version from memory twice. Then test the edge cases: one row, all identical dates, and multiple ties at each end. Check that your output columns are named FULL_NAME and DATE_OF_BIRTH in that order.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Intuit.

OA at Intuit?
Invisible during screen share
Get it