10times interview question

coding and sql query question