I've never found a tutorial that makes any sense to me, I just beat my head against the wall every time and hope something eventually works.

I assume that the data is correct and my query is wrong, and iterate until the query is more or less correct.