InfoCepts interview question

Query related to SQL optimization