GEP Interview Question

Sql question to find out second highest salary And java question to write count of string