Added query to the database