Yes Madam Interview Question

Query based on joins