Cognizant interview question

Fanily tree sql question and statistics knowledge