News for hackers. Stuff that matters.

regexman1

Re:Show HN: How much of Hacker News is AI? on Wednesday August 26, 2026 @10:24AM (#49449800)
Brilliant
Re:SQL Tips and Tricks on Wednesday October 02, 2024 @12:13AM (#41717093)
I'm an analyst so I literally only query for analytical purposes. I don't have any SQL code embedded in an application so the 1=1 is purely for tweaking/testing a query more quickly.

I certainly didn't use AI, all these tips/tricks are from work experience and reading Snowflake documentation and the like, but I guess I can't convince you either way. Regardless I appreciate the feedback, even if I did find the tone a little aggressive.

Re:SQL Tips and Tricks on Thursday September 26, 2024 @07:26PM (#41664669)
I've amended the README.md to explain what I meant. My error was in using the word dynamic!
Re:SQL Tips and Tricks on Thursday September 26, 2024 @07:20PM (#41664623)
Just to be clear I'm using it for the same reason as trailing commas.

If I'm inspecting a dataset I use WHERE 1=1 so I can add and remove conditions more easily.

I realise the confusion is in my wording of dynamic - I might amend the README.md to clarify. Thanks for the feedback!

Re:SQL Tips and Tricks on Wednesday September 25, 2024 @09:18AM (#41647187)
That's right - it's just a quicker way of being able to comment/uncomment conditions when doing EDA or debugging.
Re:SQL Tips and Tricks on Wednesday September 25, 2024 @03:02AM (#41644482)
Not at all actually, I just hadn't really planned to add this as a tip. Additionally I thought an in-line view was fine for the examples included. But maybe I will!
Re:SQL Tips and Tricks on Wednesday September 25, 2024 @02:50AM (#41644417)
Fair point!
Re:SQL Tips and Tricks on Wednesday September 25, 2024 @02:44AM (#41644375)
I appreciate the feedback, no offence taken. I'm an analyst so I often find the leading comma useful when I'm testing something and want to quickly comment a column out but I take your point.

And I agree, I should have used CTEs for this query, I was just trying to save lines of code which had the unintended consequence of quite an ugly query. However I did want to use it as an example of indentation being useful to make it slightly easier to read. Although perhaps I'm the only one who thinks so.

I greatly appreciate the constructive criticism.

Re:SQL Tips and Tricks on Wednesday September 25, 2024 @02:15AM (#41644203)
That's a totally valid point haha.
Re:SQL Tips and Tricks on Wednesday September 25, 2024 @02:15AM (#41644200)
I didn't realise that, great to know. Thanks!
Re:SQL Tips and Tricks on Wednesday September 25, 2024 @02:14AM (#41644190)
I'll add this as a caveat. I'm an analyst so my SQL isn't really exposed to anyone other than myself and so I wasn't aware of this, thanks for flagging.