Cognizant Interview Question

Few SQL queries, Code to implement polymorphism