jjjalljs,

I get mildly mad all the time when writing SQL because I feel like it’s upside down

Instead of


<span style="color:#323232;">select u.id. u.email, p.name
</span><span style="color:#323232;">from user u
</span><span style="color:#323232;">join persona p on p.user_id = u.id
</span><span style="color:#323232;">where u.active = true
</span>

where the columns are referenced before they’re defined (like what is u.id? Keep reading to find out!)

it should instead be


<span style="color:#323232;">from user u
</span><span style="color:#323232;">join persona p on u.id = p.user_id
</span><span style="color:#323232;">where u.active = true
</span><span style="color:#323232;">select u.id, u.email, p.name
</span>

Now nothing is defined before it’s used, and you’re less likely to miss your where clause. I usually write the joins first anyway because I know what tables I care about, but don’t know which specific things I’ll want.

I can’t think of any other languages that use things before they’re defined except extremely dysfunctional JavaScript.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • uselessserver093
  • Food
  • aaaaaaacccccccce
  • [email protected]
  • test
  • CafeMeta
  • testmag
  • MUD
  • RhythmGameZone
  • RSS
  • dabs
  • Socialism
  • KbinCafe
  • TheResearchGuardian
  • oklahoma
  • feritale
  • SuperSentai
  • KamenRider
  • All magazines