format sql queries