updated sql and rev