Hacker News new | ask | show | jobs
by hyperman1 637 days ago
This could be a great comment if the tone was different. I'll try to give my perspective.

SQL, unfortunately, is very verbose and has a strange mix of super-high and very low abstraction. There is also no SQL formatter out there that does a decent job, and no real consensus about how good SQL is supposed to look.

If I look at the 'indent' guideline, it contains e.g.:

  , IFF(DATEDIFF(DAY, timeslot_date, CURRENT_DATE()) >= 29, 
  LAG(overnight_fta_share, 2) OVER (PARTITION BY timeslot_date, timeslot_channel ORDER BY timeslot_activity), 
   NULL) AS C28_fta_share
Immediate SQL failures: 1) it has no easy facility to pull that DATEDIFF clause in a different variable/field. 2) The LAG line is verbose, especially if your DB doesn't allow to pull out the WINDOW clause.