[TASK] Optimise sql file

Optimise sql to remove unwnted data.