Cognizant interview question

Few SQL queries, Code to implement polymorphism