News for hackers. Stuff that matters.
Re:Learn SQL, dammit by sehrope on Wednesday May 08, 2013 @02:55PM (#5676109)
If you really want to master non-trivial SQL learn to think about filtering, joining, and combining data via set theory. Once you can logically break down the set you're trying to get to the rest then just becomes learning/looking-up syntax.

The other big piece of advice is the tried and true incremental approach. The more complicated something is, the more likely I am to use the SQL client the way one uses a REPL and incrementally write the query:

    1. Write basic SELECT
    2. Add another clause (WHERE filter, GROUP BY, etc...)
    3. Execute (syntax/sanity test)
    4. Finish or Goto step 2
Just like everything else in programming it's amazing how much simpler things are when you just piece them together one step at a time.

[1]: https://en.wikipedia.org/wiki/Set_theory

[2]: http://seanmehan.globat.com/blog/2011/12/20/set-theory-and-s...

Re:Learn SQL, dammit by tom_b on Wednesday May 08, 2013 @04:06PM (#5676525)
I believe it's somewhat impossible to overestimate how REPL-like data munging with SQL actually is. Particularly as the complexity of your data exploration increases.

Celko calls this "thinking in sets."