sql statements and use within rmysql