Tatvasoft interview question

Simple sql query Pattern program