Take Joe Celcko SQL for Smarties . This is one of the final books like "your-sql-to-the-next-level". Otherwise, just keep writing queries.
Make sure you understand the connections. Since the beginning of time, my SQL methodology has always been counted by the number of rows. In other words, when I write a complex query, I am always # 1, making sure that it returns the correct number of rows. If your rowcount is correct, then your amounts / groups / aggregates will be correct. And they are VERY easy to spoil.
Make sure you understand the data. Make sure you understand the keys and uniqueness so that you can apply your connections.
You can also read asktom.oracle.com for lots of really cool SQL tricks. Laurent Schneider is also very sql-wise in front of me. I would not be half the DBA / Developer that I am today if I had not asked asktom as my homepage for the last 5-6 years.
Finally, make sure you understand dial-based operations. Think of the multitude of results in general, not just the rowset. He will click when you do this. This refers to a methodology based on counting the number of rows.
Neil kodner
source share