I'd like to learn how to write advanced SQL queries and I was wondering if there's any book/ebook/links that might help. I've done a basic database course at school where I was taught to write simple queries. I'm looking forward to learn the complex ones like to how to get data through SQL query to draw histogram(not simple ones). This is just an example.

Could you please give me a starting point? I'm trying to prepare for an interview where I am told that I'd be asked to write complicated SQL queries.