Reformat apidb backend SQL statements for clarity

No changes in the SQL, just whitespace and caps changes