News for hackers. Stuff that matters.
Re:SQL Tips and Tricks by hyperman1 on Wednesday September 25, 2024 @04:16AM (#41645011)
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.

There are no comments on this comment yet.