Better HN
topnewbestaskshowjobs
Log inSign up

howItsDone123

6 karma · joined Mar 21, 2016 (10y ago) · 4 submissions

Submissions

comment 10y ago · link · parent

Is this a legal strategy? It seems illegal.

comment 10y ago · link · parent

I use this style. I work with queries that are a little bigger than average, and it's very difficult to keep track of it unless it's well laid out.

conditionals, loops, etc, get formatted like they would in a procedural language. the DML gets formatted similarly to what you've posted.

a not unrealistic example from this morning is as follows:

  if (select object_id('aTableName', 'u')) is not null begin
    select column
      from aTableName
     where thisIsTrue = 1
           and somethingIs in (select aList from aListTable)
           and somethingElse = (
             select aValue
               from aValueTable
              where aValue = 'somethingImportant'
           )
  end else begin
    print('Oh noes! I couldn't find somethingImportant or something in someList form aTable!')
  end
we work with huge amounts of data with systems and processes that don't lend themselves to other methods (yet... it's coming.) so we have to make SQL as readable as possible.

edit: yes... i know... subqueries are bad... it's just an example. those would have been done in joins or as temporary variables or something else.

comment 10y ago · link · parent

I'll start my own celebration day. Programmer's Day. It's basically the same, with some improvements, and does not comply with the existing standard.

Everyone who is frustrated with this confusion about the Day of the Programmer, come celebrate Programmer's Day which is exactly the same but different!

comment 10y ago · link · parent

I'm a big supporter of wearing the ear plugs. They're better at blocking noise, and turning the volume up on headphones to drown out background noise will leave you deaf.

But, you do look like both a tool and a jerk if you're wearing earplugs in an office.

I started putting headphones on over earplugs. All the benefits of earplugs, none of the drawbacks.