"Finding All Children of Parent 'A'"

Given a table with two columns, "name" and "parent", write a SQL query to find all the children of the parent "A".

Problem

Given a table with two columns, "name" and "parent", write a SQL query to find all the children of the parent "A".
Input:
name | parent
-----|--------
A | NULL
B | A
C | A
D | B
E | B
F | C
Output:
name | parent
-----|--------
B | A
C | A
D | B
E | B
F | C

Solution

This solution is in SQL. Our A.I. can create solutions in multiple languages.
by sarastevens
SELECT * FROM table WHERE parent = 'A';

/*

The above solution is optimal because it uses the WHERE clause to filter the results to only those that have a parent of 'A'.

*/

A.I. Evaluation of the Solution

The candidate's solution is correct and demonstrates a good understanding of SQL. The solution is also efficient, using the WHERE clause to filter the results.

Evaluated at: 2022-11-19 10:15:56