|
| ▲ | wvbdmp 16 hours ago | parent | next [-] |
| Anti-Patterns You Should Avoid: overengineering for potential future requirements. Are there real-life cases where you should design with the future in mind? Yes. Are there real-life cases where DISTINCT is the best choice by whatever metric you prioritize at the time? Also yes. |
| |
| ▲ | RHSeeger 15 hours ago | parent [-] | | > Are there real-life cases where DISTINCT is the best choice by whatever metric you prioritize at the time Indeed, along that line, I would say that DISTINCT can be used to convey intent... and doing that in code is important. - I want to know the zipcodes we have customers in - DISTINCT - I want to know how many customers we have in each zipcode - aggregates Can you do the first with the second? Sure.. but the first makes it clear what your goal is. | | |
| ▲ | dleeftink 13 hours ago | parent [-] | | Partly in jest, but maybe we need a NON-DISTINCT signaller to convey the inverse and return duplicate values only. SOMEWHAT-DISTINCT with a fuzzy threshold would also be useful. | | |
| ▲ | RHSeeger 11 hours ago | parent [-] | | I hear you. It's not all _that_ uncommon for me to query for "things with more than one instance". Although, to be fair, it's more common for me to that when grep/sort/uniqing logs on the command line. |
|
|
|
|
| ▲ | majormajor 15 hours ago | parent | prev | next [-] |
| Here we start to get close to analytics sql vs application sql, and I think that's a whole separate beast itself with different patterns and anti-patterns. |
| |
|
| ▲ | bandrami 11 hours ago | parent | prev | next [-] |
| I do reporting, not application development. If somebody wants to know different information I'd write a different query. |
|
| ▲ | kristjansson 16 hours ago | parent | prev | next [-] |
| Whole seconds will have been wasted! |
|
| ▲ | sql_nitpicker 16 hours ago | parent | prev | next [-] |
| distinct seems like an aggregation to me |
| |
|
| ▲ | edoceo 16 hours ago | parent | prev [-] |
| count(id) group by post_code order by 1 |