An application for testing programmers contains an initial question version and newer question versions, represented by the following schema:
TABLE questions id INTEGER NOT NULL PRIMARY KEY name VARCHAR(50) NOT NULL childId INTEGER FOREIGN KEY (childId) REFERENCES questions(id)
The latest question version has childId set to NULL, other question versions will have childId set to the next version. Each question version can be a child of only one other question version.
Finish the findLatestVersion stored procedure so that it returns the latest question version.
See the example case for more details.
- Example case: Wrong answer
- Calling the procedure with the parent of the latest question: Wrong answer
- Calling the procedure with older question versions: Wrong answer