DEV Community

Discussion on: How To Write Better SQL: Advanced SQL Episode 1

Collapse
 
maxidirienzo profile image
Maxi Di Rienzo

I believe that for the provided cases -it's clearer in the 1st example where you have ranges, instead of the last 3 IDs that maps to the same label in the 2nd example- a much better solution would be to use a function instead of one or two (many to many) tables, this of course could be coded in the same DB engine or in the app layer.