I came across a question which is described below. Here, I wrote the required query. But I have a doubt whether its syntax is correct.
The schema is as follows: