Adding the final sql