In my MySQL Database all the entries have a rating(an Integer). Now I want to have a SQL query that delivers 10 elements randomly. And as you probably guess, an element's chance to be taken should be RatingOfThisElement/AllRatings. How can I do that. (I know how to do it in php but I'd like to have a SQL query because of the performance).
Google should help you with this: http://akinas.com/pages/en/blog/mysql_random_row/
You can use ORDER BY RAND() LIMIT 10 such as here MySQL: Alternatives to ORDER BY RAND() but there are issues with ORDER BY RAND in MySQL if used in certain ways. It can case huge performance issues and you may be better off doing it in PHP - alternatives to ORDER BY RAND
here is the solution
SELECT * FROM yourtablename ORDER BY RAND() LIMIT 0,10;