Improve table query format