adds sql stuff for ratings