updated sql statements