optimization of sql queries

optimization of sql queries