Added database table prefix

Added database table prefix and changed query.