Write a SQL query to check whether a given directory is correct, given a table with the directory details. Asked in the Technical 3 stage. For this exercise, evaluate the directory path /claims/archive.
Return whether the requested directory exists, has a valid parent, and matches the path derived from its parent and directory name.
/claims/archive.directory_path, is_correct, and validation_status.is_correct to a boolean and validation_status to a concise reason such as valid_directory, path_mismatch, or parent_directory_not_found.| Column | Type | Description |
|---|---|---|
| directory_pathPK | VARCHAR(255) | Full path identifying the directory |
| parent_directory_path | VARCHAR(255) | Full path of the directory's parent; NULL for the root directory |
| directory_name | VARCHAR(100) | Directory name stored for path validation |