trying to learn complex SQL Queries and active record include/joins

I am looking for rails app examples or sql database examples that I can use to play around with. I am interested in increasing my proficiency with complex SQL joins, subqueries and the like as well as complex queries through active record join/include … Any suggested samples, please let me know thanks