Simplifying SQL query
Committing local database in UpOperation