Update SQL for new table names, and prettify.