Fix syntax problems in application.sql

Also comment out view on ApplicationRecords as it is not yet correct.