Hacker News new | ask | show | jobs
by myspy 1751 days ago
Something other which is hard is writing performant queries. Using statements with subqueries/in syntax for example.

And I always forget which join does what.

2 comments

Remembering which join does what is easy: inner joins strictly joins the tables, left takes all on left (first table), right takes all on right (second table), outer (or cross) join are so rarely used you don't need to memorize.
> outer (or cross) join are so rarely used you don't need to memorize.

I’d say they are more important to know than right joins.

same with the joins. on paper it makes sense, in practice it does not. if its more than a "select * from dbo.whatever where column abc = 'thing'" i have to refer back to notes and play with it.
Basically inner/left/right is a choice on how you want your NULLs: do you want all the rows that match, all the rows on the left, or all the rows on the right?